Class: AGCOD::CreateGiftCard
- Inherits:
-
Object
- Object
- AGCOD::CreateGiftCard
- Extended by:
- Forwardable
- Defined in:
- lib/aws_agcod/create_gift_card.rb
Constant Summary collapse
- CURRENCIES =
%w(USD EUR JPY CNY CAD)
Instance Method Summary collapse
- #claim_code ⇒ Object
- #expiration_date ⇒ Object
- #gc_id ⇒ Object
-
#initialize(httpable, request_id, amount, currency = 'USD') ⇒ CreateGiftCard
constructor
A new instance of CreateGiftCard.
- #request_id ⇒ Object
Constructor Details
#initialize(httpable, request_id, amount, currency = 'USD') ⇒ CreateGiftCard
Returns a new instance of CreateGiftCard.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/aws_agcod/create_gift_card.rb', line 13 def initialize(httpable, request_id, amount, currency = 'USD') unless CURRENCIES.include?(currency.to_s) raise CreateGiftCardError, "Currency #{currency} not supported, available types are #{CURRENCIES.join(", ")}" end @response = Request.new(httpable, 'CreateGiftCard', 'creationRequestId' => request_id, 'value' => { 'currencyCode' => currency, 'amount' => amount } ).response end |
Instance Method Details
#claim_code ⇒ Object
27 28 29 |
# File 'lib/aws_agcod/create_gift_card.rb', line 27 def claim_code @response.payload['gcClaimCode'] end |
#expiration_date ⇒ Object
31 32 33 |
# File 'lib/aws_agcod/create_gift_card.rb', line 31 def expiration_date @expiration_date ||= Time.parse @response.payload['gcExpirationDate'] end |
#gc_id ⇒ Object
35 36 37 |
# File 'lib/aws_agcod/create_gift_card.rb', line 35 def gc_id @response.payload['gcId'] end |
#request_id ⇒ Object
39 40 41 |
# File 'lib/aws_agcod/create_gift_card.rb', line 39 def request_id @response.payload['creationRequestId'] end |