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
-
#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.
20323 20324 20325 20326 20327 20328 20329 20330 20331 20332 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20323 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :organization, :order, :session, :urls, :expires_at], '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)) @order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::OrderNumberReference) ? x : ::Io::Flow::V0::Models::OrderNumberReference.new(x)) @session = (x = opts.delete(:session); x.is_a?(::Io::Flow::V0::Models::SessionReference) ? x : ::Io::Flow::V0::Models::SessionReference.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) end |
Instance Attribute Details
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
20321 20322 20323 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20321 def expires_at @expires_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
20321 20322 20323 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20321 def id @id end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
20321 20322 20323 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20321 def order @order end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
20321 20322 20323 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20321 def organization @organization end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
20321 20322 20323 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20321 def session @session end |
#urls ⇒ Object (readonly)
Returns the value of attribute urls.
20321 20322 20323 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20321 def urls @urls end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
20338 20339 20340 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20338 def copy(incoming={}) CheckoutToken.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
20342 20343 20344 20345 20346 20347 20348 20349 20350 20351 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20342 def to_hash { :id => id, :organization => organization.to_hash, :order => order.to_hash, :session => session.to_hash, :urls => urls.to_hash, :expires_at => expires_at } end |
#to_json ⇒ Object
20334 20335 20336 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20334 def to_json JSON.dump(to_hash) end |