Sha256: 33eb05e07f6f0f7c44c34d0a62eb1960c93d26ed968862bf0803a6e8d93fed42

Contents?: true

Size: 1.47 KB

Versions: 24

Compression:

Stored size: 1.47 KB

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
        ),
        Centaman::Attribute.new(
          centaman_key: 'ConditionForUse',
          app_key: :condition_for_use,
          type: :string
        ),
        Centaman::Attribute.new(
          centaman_key: 'CouponStockID',
          app_key: :coupon_stock_id,
          type: :integer
        ),
        Centaman::Attribute.new(
          centaman_key: 'IsValidForNewMembership',
          app_key: :is_valid_for_new_membership,
          type: :boolean
        ),
        Centaman::Attribute.new(
          centaman_key: 'IsvalidForRenewMembership',
          app_key: :is_valid_for_renew_membership,
          type: :boolean
        )
      ]
    end
    # rubocop:enable Metrics/MethodLength
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
centaman-8.0.0 lib/centaman/object/coupon_check.rb
centaman-7.0.5 lib/centaman/object/coupon_check.rb
centaman-7.0.4 lib/centaman/object/coupon_check.rb
centaman-7.0.3 lib/centaman/object/coupon_check.rb
centaman-7.0.2 lib/centaman/object/coupon_check.rb
centaman-7.0.1 lib/centaman/object/coupon_check.rb
centaman-7.0.0 lib/centaman/object/coupon_check.rb
centaman-6.0.8 lib/centaman/object/coupon_check.rb
centaman-6.0.7 lib/centaman/object/coupon_check.rb
centaman-6.0.5 lib/centaman/object/coupon_check.rb
centaman-6.0.4 lib/centaman/object/coupon_check.rb
centaman-6.0.3 lib/centaman/object/coupon_check.rb
centaman-6.0.2 lib/centaman/object/coupon_check.rb
centaman-6.0.1 lib/centaman/object/coupon_check.rb
centaman-6.0.0 lib/centaman/object/coupon_check.rb
centaman-5.0.8 lib/centaman/object/coupon_check.rb
centaman-5.0.7 lib/centaman/object/coupon_check.rb
centaman-5.0.6 lib/centaman/object/coupon_check.rb
centaman-5.0.5 lib/centaman/object/coupon_check.rb
centaman-5.0.4 lib/centaman/object/coupon_check.rb