Class: Io::Flow::V0::Models::ShippingConfiguration

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 = {}) ⇒ ShippingConfiguration

Returns a new instance of ShippingConfiguration.



65942
65943
65944
65945
65946
65947
65948
65949
65950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65942

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :name, :key, :type, :shipping_lanes], 'ShippingConfiguration')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ShippingConfigurationType) ? x : ::Io::Flow::V0::Models::ShippingConfigurationType.apply(x))
  @shipping_lanes = HttpClient::Preconditions.assert_class('shipping_lanes', opts.delete(:shipping_lanes), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ShippingLane) ? x : ::Io::Flow::V0::Models::ShippingLane.new(x)) }
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



65940
65941
65942
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65940

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



65940
65941
65942
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65940

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



65940
65941
65942
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65940

def name
  @name
end

#shipping_lanesObject (readonly)

Returns the value of attribute shipping_lanes.



65940
65941
65942
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65940

def shipping_lanes
  @shipping_lanes
end

#typeObject (readonly)

Returns the value of attribute type.



65940
65941
65942
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65940

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



65956
65957
65958
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65956

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

#to_hashObject



65960
65961
65962
65963
65964
65965
65966
65967
65968
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65960

def to_hash
  {
    :id => id,
    :name => name,
    :key => key,
    :type => type.value,
    :shipping_lanes => shipping_lanes.map { |o| o.to_hash }
  }
end

#to_jsonObject



65952
65953
65954
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65952

def to_json
  JSON.dump(to_hash)
end