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



34930
34931
34932
34933
34934
34935
34936
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34930

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.



34928
34929
34930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34928

def destination
  @destination
end

#numberObject (readonly)

Returns the value of attribute number.



34928
34929
34930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34928

def number
  @number
end

#originObject (readonly)

Returns the value of attribute origin.



34928
34929
34930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34928

def origin
  @origin
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



34942
34943
34944
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34942

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

#to_hashObject



34946
34947
34948
34949
34950
34951
34952
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34946

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

#to_jsonObject



34938
34939
34940
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34938

def to_json
  JSON.dump(to_hash)
end