Sha256: 6cec06e8b053a4b1b5942c928c84707a18bde559ce869839d16878f4ca15f2a9

Contents?: true

Size: 870 Bytes

Versions: 16

Compression:

Stored size: 870 Bytes

Contents

module Centaman
  class Object::CouponCheck < Centaman::Object
    attr_reader :effects

    def after_init(args = {})
      define_effects(args)
    end

    def define_effects(args)
      @effects = args['Effects'].map do |effect_hash|
        Centaman::Object::Effect.new(effect_hash)
      end
    end

    # rubocop:disable Metrics/MethodLength
    def attributes
      [
        Centaman::Attribute.new(
          centaman_key: 'CouponCode',
          app_key: :coupon_code,
          type: :string
        ),

        Centaman::Attribute.new(
          centaman_key: 'LimitedUse',
          app_key: :limited_use,
          type: :boolean
        ),
        Centaman::Attribute.new(
          centaman_key: 'UsesRemaining',
          app_key: :uses_remaining,
          type: :integer
        )
      ]
    end
    # rubocop:enable Metrics/MethodLength
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
centaman-4.0.5 lib/centaman/object/coupon_check.rb
centaman-4.0.4 lib/centaman/object/coupon_check.rb
centaman-4.0.3 lib/centaman/object/coupon_check.rb
centaman-4.0.2 lib/centaman/object/coupon_check.rb
centaman-4.0.1 lib/centaman/object/coupon_check.rb
centaman-3.1.2 lib/centaman/object/coupon_check.rb
centaman-3.1.1 lib/centaman/object/coupon_check.rb
centaman-3.1.0 lib/centaman/object/coupon_check.rb
centaman-3.0.0 lib/centaman/object/coupon_check.rb
centaman-2.1.0 lib/centaman/object/coupon_check.rb
centaman-2.0.0 lib/centaman/object/coupon_check.rb
centaman-1.0.0 lib/centaman/object/coupon_check.rb
centaman-0.2.3 lib/centaman/object/coupon_check.rb
centaman-0.2.2 lib/centaman/object/coupon_check.rb
centaman-0.2.1 lib/centaman/object/coupon_check.rb
centaman-0.2.0 lib/centaman/object/coupon_check.rb