Class: Centaman::Service::CouponCheck

Inherits:
Centaman::Service show all
Includes:
JsonWrapper
Defined in:
lib/centaman/service/coupon_check.rb

Constant Summary

Constants inherited from Centaman::Service

DEFAULT_TIMEOUT_TIME

Constants inherited from Wrapper

Wrapper::FIXIE

Instance Attribute Summary collapse

Attributes inherited from Wrapper

#api_password, #api_token, #api_username

Instance Method Summary collapse

Methods included from JsonWrapper

#additional_hash_to_serialize_after_response, #build_object, #build_objects, #objects

Methods inherited from Centaman::Service

#after_post, #fetch_all, #payload, #payload_key, #post, #wrap_request_in_case_of_timeout

Methods inherited from Wrapper

#generate_token, #headers, #initialize, #options

Constructor Details

This class inherits a constructor from Centaman::Wrapper

Instance Attribute Details

#coupon_codeObject (readonly)

Returns the value of attribute coupon_code.



4
5
6
# File 'lib/centaman/service/coupon_check.rb', line 4

def coupon_code
  @coupon_code
end

Instance Method Details

#after_init(args) ⇒ Object



6
7
8
9
# File 'lib/centaman/service/coupon_check.rb', line 6

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

#endpointObject



11
12
13
# File 'lib/centaman/service/coupon_check.rb', line 11

def endpoint
  '/coupon_services/check'
end

#object_classObject



15
16
17
# File 'lib/centaman/service/coupon_check.rb', line 15

def object_class
  Centaman::Object::CouponCheck
end

#options_hashObject



19
20
21
22
23
24
# File 'lib/centaman/service/coupon_check.rb', line 19

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

#require_argsObject



26
27
28
# File 'lib/centaman/service/coupon_check.rb', line 26

def require_args
  raise "coupon_code is required for #{self.class.name}" if coupon_code.nil?
end