Sha256: 3c0f59266d0f1adb13f26951daf3ea80fb0ba191b8023347d280841f521bdc9b

Contents?: true

Size: 745 Bytes

Versions: 42

Compression:

Stored size: 745 Bytes

Contents

module Centaman
  class Service::CouponCheck < Centaman::Service
    include Centaman::JsonWrapper
    attr_reader :coupon_code, :product_area

    def after_init(args)
      @coupon_code = args[:coupon_code]
      @product_area = args[:product_area]
      require_args
    end

    def endpoint
      '/coupon_services/check'
    end

    def object_class
      Centaman::Object::CouponCheck
    end

    def options_hash
      {
        'CouponCode' => coupon_code,
        'ProductArea' => product_area
      }.to_json
    end

    def required_fields
      [coupon_code, product_area]
    end

    def require_args
      raise "coupon_code and product_area required for #{self.class.name}" if required_fields.include?(nil)
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

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