Class: Io::Flow::V0::Models::CheckoutToken
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CheckoutToken
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a secure token that can be used to redirect to Checkout UI
Instance Attribute Summary collapse
-
#checkout ⇒ Object
readonly
Returns the value of attribute checkout.
-
#customer ⇒ Object
readonly
Returns the value of attribute customer.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#urls ⇒ Object
readonly
Returns the value of attribute urls.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CheckoutToken
constructor
A new instance of CheckoutToken.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CheckoutToken
Returns a new instance of CheckoutToken.
25318 25319 25320 25321 25322 25323 25324 25325 25326 25327 25328 25329 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25318 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :organization, :checkout, :order, :urls, :expires_at, :session], 'CheckoutToken') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @organization = (x = opts.delete(:organization); x.is_a?(::Io::Flow::V0::Models::OrganizationReference) ? x : ::Io::Flow::V0::Models::OrganizationReference.new(x)) @checkout = (x = opts.delete(:checkout); x.is_a?(::Io::Flow::V0::Models::CheckoutReference) ? x : ::Io::Flow::V0::Models::CheckoutReference.new(x)) @order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::OrderNumberReference) ? x : ::Io::Flow::V0::Models::OrderNumberReference.new(x)) @urls = (x = opts.delete(:urls); x.is_a?(::Io::Flow::V0::Models::CheckoutUrls) ? x : ::Io::Flow::V0::Models::CheckoutUrls.new(x)) @expires_at = HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:expires_at)), DateTime) @session = (x = opts.delete(:session); x.is_a?(::Io::Flow::V0::Models::SessionReference) ? x : ::Io::Flow::V0::Models::SessionReference.new(x)) @customer = (x = opts.delete(:customer); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CustomerReference) ? x : ::Io::Flow::V0::Models::CustomerReference.new(x))) end |
Instance Attribute Details
#checkout ⇒ Object (readonly)
Returns the value of attribute checkout.
25316 25317 25318 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25316 def checkout @checkout end |
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
25316 25317 25318 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25316 def customer @customer end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
25316 25317 25318 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25316 def expires_at @expires_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
25316 25317 25318 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25316 def id @id end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
25316 25317 25318 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25316 def order @order end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
25316 25317 25318 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25316 def organization @organization end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
25316 25317 25318 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25316 def session @session end |
#urls ⇒ Object (readonly)
Returns the value of attribute urls.
25316 25317 25318 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25316 def urls @urls end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
25335 25336 25337 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25335 def copy(incoming={}) CheckoutToken.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
25339 25340 25341 25342 25343 25344 25345 25346 25347 25348 25349 25350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25339 def to_hash { :id => id, :organization => organization.to_hash, :checkout => checkout.to_hash, :order => order.to_hash, :urls => urls.to_hash, :expires_at => expires_at, :session => session.to_hash, :customer => customer.nil? ? nil : customer.to_hash } end |
#to_json ⇒ Object
25331 25332 25333 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25331 def to_json JSON.dump(to_hash) end |