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.
71736 71737 71738 71739 71740 71741 71742 71743 71744 71745 71746 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71736 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.
71734 71735 71736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71734 def destinations @destinations end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
71734 71735 71736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71734 def effective_at @effective_at end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
71734 71735 71736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71734 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
71734 71735 71736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71734 def name @name end |
#origins ⇒ Object (readonly)
Returns the value of attribute origins.
71734 71735 71736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71734 def origins @origins end |
#ship_from ⇒ Object (readonly)
Returns the value of attribute ship_from.
71734 71735 71736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71734 def ship_from @ship_from end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
71734 71735 71736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71734 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
71752 71753 71754 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71752 def copy(incoming={}) TradeAgreement.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
71756 71757 71758 71759 71760 71761 71762 71763 71764 71765 71766 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71756 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
71748 71749 71750 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71748 def to_json JSON.dump(to_hash) end |