Class: Io::Flow::V0::Clients::MerchantGiftCardRedemptions

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ MerchantGiftCardRedemptions

Returns a new instance of MerchantGiftCardRedemptions.



7542
7543
7544
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7542

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#post(merchant_gift_card_redemption_form) ⇒ Object

Redeems a gift card



7547
7548
7549
7550
7551
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7547

def post(merchant_gift_card_redemption_form)
  (x = merchant_gift_card_redemption_form; x.is_a?(::Io::Flow::V0::Models::MerchantGiftCardRedemptionForm) ? x : ::Io::Flow::V0::Models::MerchantGiftCardRedemptionForm.new(x))
  r = @client.request("/redeem").with_json(merchant_gift_card_redemption_form.to_json).post
  ::Io::Flow::V0::Models::MerchantGiftCardBalance.new(r)
end