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.



61957
61958
61959
61960
61961
61962
61963
61964
61965
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61957

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.



61955
61956
61957
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61955

def direction
  @direction
end

#fromObject (readonly)

Returns the value of attribute from.



61955
61956
61957
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61955

def from
  @from
end

#preferenceObject (readonly)

Returns the value of attribute preference.



61955
61956
61957
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61955

def preference
  @preference
end

#strategyObject (readonly)

Returns the value of attribute strategy.



61955
61956
61957
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61955

def strategy
  @strategy
end

#toObject (readonly)

Returns the value of attribute to.



61955
61956
61957
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61955

def to
  @to
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



61971
61972
61973
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61971

def copy(incoming={})
  ShippingLaneForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



61975
61976
61977
61978
61979
61980
61981
61982
61983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61975

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



61967
61968
61969
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61967

def to_json
  JSON.dump(to_hash)
end