Class: Io::Flow::V0::Models::ShippingLaneForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#directionObject (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

#fromObject (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

#preferenceObject (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

#strategyObject (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

#toObject (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_hashObject



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_jsonObject



66843
66844
66845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66843

def to_json
  JSON.dump(to_hash)
end