Class: Io::Flow::V0::Models::TradeAgreement
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TradeAgreement
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#destinations ⇒ Object
readonly
Returns the value of attribute destinations.
-
#effective_at ⇒ Object
readonly
Returns the value of attribute effective_at.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#origins ⇒ Object
readonly
Returns the value of attribute origins.
-
#ship_from ⇒ Object
readonly
Returns the value of attribute ship_from.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TradeAgreement
constructor
A new instance of TradeAgreement.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TradeAgreement
Returns a new instance of TradeAgreement.
63426 63427 63428 63429 63430 63431 63432 63433 63434 63435 63436 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63426 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:key, :name, :origins, :destinations, :effective_at, :status], 'TradeAgreement') @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @name = (x = opts.delete(:name); x.is_a?(::Io::Flow::V0::Models::TradeAgreementName) ? x : ::Io::Flow::V0::Models::TradeAgreementName.apply(x)) @origins = HttpClient::Preconditions.assert_class('origins', opts.delete(:origins), Array).map { |v| HttpClient::Preconditions.assert_class('origins', v, String) } @destinations = HttpClient::Preconditions.assert_class('destinations', opts.delete(:destinations), Array).map { |v| HttpClient::Preconditions.assert_class('destinations', v, String) } @ship_from = (x = opts.delete(:ship_from); x.nil? ? nil : HttpClient::Preconditions.assert_class('ship_from', x, Array).map { |v| HttpClient::Preconditions.assert_class('ship_from', v, String) }) @effective_at = HttpClient::Preconditions.assert_class('effective_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:effective_at)), DateTime) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::TradeAgreementStatus) ? x : ::Io::Flow::V0::Models::TradeAgreementStatus.apply(x)) end |
Instance Attribute Details
#destinations ⇒ Object (readonly)
Returns the value of attribute destinations.
63424 63425 63426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63424 def destinations @destinations end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
63424 63425 63426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63424 def effective_at @effective_at end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
63424 63425 63426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63424 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
63424 63425 63426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63424 def name @name end |
#origins ⇒ Object (readonly)
Returns the value of attribute origins.
63424 63425 63426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63424 def origins @origins end |
#ship_from ⇒ Object (readonly)
Returns the value of attribute ship_from.
63424 63425 63426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63424 def ship_from @ship_from end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
63424 63425 63426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63424 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
63442 63443 63444 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63442 def copy(incoming={}) TradeAgreement.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
63446 63447 63448 63449 63450 63451 63452 63453 63454 63455 63456 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63446 def to_hash { :key => key, :name => name.value, :origins => origins, :destinations => destinations, :ship_from => ship_from.nil? ? nil : ship_from, :effective_at => effective_at, :status => status.value } end |
#to_json ⇒ Object
63438 63439 63440 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63438 def to_json JSON.dump(to_hash) end |