Class: Io::Flow::V0::Models::ShippingLaneForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShippingLaneForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#preference ⇒ Object
readonly
Returns the value of attribute preference.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShippingLaneForm
constructor
A new instance of ShippingLaneForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingLaneForm
Returns a new instance of ShippingLaneForm.
66833 66834 66835 66836 66837 66838 66839 66840 66841 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66833 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:from, :to], 'ShippingLaneForm') @from = HttpClient::Preconditions.assert_class('from', opts.delete(:from), String) @to = HttpClient::Preconditions.assert_class('to', opts.delete(:to), String) @strategy = (x = opts.delete(:strategy); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LaneStrategy) ? x : ::Io::Flow::V0::Models::LaneStrategy.apply(x))) @direction = (x = opts.delete(:direction); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LaneDirection) ? x : ::Io::Flow::V0::Models::LaneDirection.apply(x))) @preference = (x = opts.delete(:preference); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LanePreselectPreference) ? x : ::Io::Flow::V0::Models::LanePreselectPreference.apply(x))) end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
66831 66832 66833 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66831 def direction @direction end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
66831 66832 66833 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66831 def from @from end |
#preference ⇒ Object (readonly)
Returns the value of attribute preference.
66831 66832 66833 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66831 def preference @preference end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
66831 66832 66833 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66831 def strategy @strategy end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
66831 66832 66833 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66831 def to @to end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
66847 66848 66849 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66847 def copy(incoming={}) ShippingLaneForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
66851 66852 66853 66854 66855 66856 66857 66858 66859 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66851 def to_hash { :from => from, :to => to, :strategy => strategy.nil? ? nil : strategy.value, :direction => direction.nil? ? nil : direction.value, :preference => preference.nil? ? nil : preference.value } end |
#to_json ⇒ Object
66843 66844 66845 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66843 def to_json JSON.dump(to_hash) end |