Skip to content

Expects and promises聽#159

Open
Open

Description

@cabello

Hi 馃憢

I recently found this gem https://github.com/adomokos/light-service and one thing I liked was the fact that you can specify what's expected from the context and what will be set on the context.

class LooksUpTaxPercentageAction
  extend LightService::Action
  expects :order
  promises :tax_percentage

I've been doing delegate calls to mimic the expects functionality, I have nothing for the promises.

Is that something you would welcome a PR for?

Activity

  1. natebird commented on Oct 2, 2018

    @natebird

    I think this would be a worthwhile addition. I've just added comments at the top of the class about what's required input and what is expected output. Defining it might clean up some of the boilerplate code I create like this:

        if context.location.blank? || context.calibration.blank?
          Rails.logger.info 'AddCalibrationLocation [ SKIPPED - MISSING INFO ]'
          return false
        end
  2. dikond commented on Oct 3, 2018

    @dikond

    Hey, take a look at Hanami::Interactor - it's simpler than collectiveidea's interactor (no Organizaer, callbacks, rollback) but thanks to its API you can clearly see the input and the output :)

  3. gee-forr commented on Aug 4, 2019

    @gee-forr

    You could also try this out: https://github.com/michaelherold/interactor-contracts

    It takes what light-service does, and quite a bit further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions