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.
48761 48762 48763 48764 48765 48766 48767 48768 48769 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48761 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.
48759 48760 48761 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48759 def direction @direction end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
48759 48760 48761 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48759 def from @from end |
#preference ⇒ Object (readonly)
Returns the value of attribute preference.
48759 48760 48761 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48759 def preference @preference end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
48759 48760 48761 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48759 def strategy @strategy end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
48759 48760 48761 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48759 def to @to end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
48775 48776 48777 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48775 def copy(incoming={}) ShippingLaneForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
48779 48780 48781 48782 48783 48784 48785 48786 48787 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48779 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
48771 48772 48773 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48771 def to_json JSON.dump(to_hash) end |