class AGCOD::CreateGiftCard

Constants

CURRENCIES

Public Class Methods

new(httpable, request_id, amount, currency = 'USD') click to toggle source
# 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

Public Instance Methods

claim_code() click to toggle source
# File lib/aws_agcod/create_gift_card.rb, line 27
def claim_code
  @response.payload['gcClaimCode']
end
expiration_date() click to toggle source
# File lib/aws_agcod/create_gift_card.rb, line 31
def expiration_date
  @expiration_date ||= Time.parse @response.payload['gcExpirationDate']
end
gc_id() click to toggle source
# File lib/aws_agcod/create_gift_card.rb, line 35
def gc_id
  @response.payload['gcId']
end
request_id() click to toggle source
# File lib/aws_agcod/create_gift_card.rb, line 39
def request_id
  @response.payload['creationRequestId']
end