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.



50959
50960
50961
50962
50963
50964
50965
50966
50967
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50959

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.



50957
50958
50959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50957

def direction
  @direction
end

#fromObject (readonly)

Returns the value of attribute from.



50957
50958
50959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50957

def from
  @from
end

#preferenceObject (readonly)

Returns the value of attribute preference.



50957
50958
50959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50957

def preference
  @preference
end

#strategyObject (readonly)

Returns the value of attribute strategy.



50957
50958
50959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50957

def strategy
  @strategy
end

#toObject (readonly)

Returns the value of attribute to.



50957
50958
50959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50957

def to
  @to
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



50973
50974
50975
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50973

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

#to_hashObject



50977
50978
50979
50980
50981
50982
50983
50984
50985
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50977

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



50969
50970
50971
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50969

def to_json
  JSON.dump(to_hash)
end