Sha256: c93364a0d030a86cad613ccd4296dc849c82514dc748b54c44a6bbe794c521a9

Contents?: true

Size: 870 Bytes

Versions: 12

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: :integer
        ),
        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

12 entries across 12 versions & 1 rubygems

Version Path
centaman-0.1.11 lib/centaman/object/coupon_check.rb
centaman-0.1.10 lib/centaman/object/coupon_check.rb
centaman-0.1.9 lib/centaman/object/coupon_check.rb
centaman-0.1.8 lib/centaman/object/coupon_check.rb
centaman-0.1.7 lib/centaman/object/coupon_check.rb
centaman-0.1.6 lib/centaman/object/coupon_check.rb
centaman-0.1.5 lib/centaman/object/coupon_check.rb
centaman-0.1.4 lib/centaman/object/coupon_check.rb
centaman-0.1.3 lib/centaman/object/coupon_check.rb
centaman-0.1.2 lib/centaman/object/coupon_check.rb
centaman-0.1.1 lib/centaman/object/coupon_check.rb
centaman-0.1.0 lib/centaman/object/coupon_check.rb