Class: Io::Flow::V0::Models::LandedCostItem

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

Overview

Tuple of item number, origin (from) country and destination (to) country

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LandedCostItem

Returns a new instance of LandedCostItem.



37297
37298
37299
37300
37301
37302
37303
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37297

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:number, :origin, :destination], 'LandedCostItem')
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @origin = HttpClient::Preconditions.assert_class('origin', opts.delete(:origin), String)
  @destination = HttpClient::Preconditions.assert_class('destination', opts.delete(:destination), String)
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



37295
37296
37297
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37295

def destination
  @destination
end

#numberObject (readonly)

Returns the value of attribute number.



37295
37296
37297
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37295

def number
  @number
end

#originObject (readonly)

Returns the value of attribute origin.



37295
37296
37297
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37295

def origin
  @origin
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37309
37310
37311
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37309

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

#to_hashObject



37313
37314
37315
37316
37317
37318
37319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37313

def to_hash
  {
    :number => number,
    :origin => origin,
    :destination => destination
  }
end

#to_jsonObject



37305
37306
37307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37305

def to_json
  JSON.dump(to_hash)
end