Class: Io::Flow::V0::Models::Carrier

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

Overview

Partner that actually takes a shipment between places (ex: FedEx, DHL, SF Express)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Carrier

Returns a new instance of Carrier.



24588
24589
24590
24591
24592
24593
24594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24588

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :name, :tracking_url], 'Carrier')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @tracking_url = HttpClient::Preconditions.assert_class('tracking_url', opts.delete(:tracking_url), String)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



24586
24587
24588
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24586

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



24586
24587
24588
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24586

def name
  @name
end

#tracking_urlObject (readonly)

Returns the value of attribute tracking_url.



24586
24587
24588
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24586

def tracking_url
  @tracking_url
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



24600
24601
24602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24600

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

#to_hashObject



24604
24605
24606
24607
24608
24609
24610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24604

def to_hash
  {
    :id => id,
    :name => name,
    :tracking_url => tracking_url
  }
end

#to_jsonObject



24596
24597
24598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24596

def to_json
  JSON.dump(to_hash)
end