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.



49458
49459
49460
49461
49462
49463
49464
49465
49466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49458

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.



49456
49457
49458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49456

def direction
  @direction
end

#fromObject (readonly)

Returns the value of attribute from.



49456
49457
49458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49456

def from
  @from
end

#preferenceObject (readonly)

Returns the value of attribute preference.



49456
49457
49458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49456

def preference
  @preference
end

#strategyObject (readonly)

Returns the value of attribute strategy.



49456
49457
49458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49456

def strategy
  @strategy
end

#toObject (readonly)

Returns the value of attribute to.



49456
49457
49458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49456

def to
  @to
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



49472
49473
49474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49472

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

#to_hashObject



49476
49477
49478
49479
49480
49481
49482
49483
49484
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49476

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



49468
49469
49470
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49468

def to_json
  JSON.dump(to_hash)
end