Class: Io::Flow::V0::Models::Center

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

Overview

Represents a facility capable of fulfilling a shipment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Center

Returns a new instance of Center.



16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16924

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :key, :address, :packaging, :name, :services, :schedule, :timezone], 'Center')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))
  @packaging = HttpClient::Preconditions.assert_class('packaging', opts.delete(:packaging), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Packaging) ? x : ::Io::Flow::V0::Models::Packaging.new(x)) }
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @services = HttpClient::Preconditions.assert_class('services', opts.delete(:services), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AvailableService) ? x : ::Io::Flow::V0::Models::AvailableService.new(x)) }
  @schedule = (x = opts.delete(:schedule); x.is_a?(::Io::Flow::V0::Models::Schedule) ? x : ::Io::Flow::V0::Models::Schedule.new(x))
  @timezone = HttpClient::Preconditions.assert_class('timezone', opts.delete(:timezone), String)
  @capabilities = (x = opts.delete(:capabilities); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CenterCapabilities) ? x : ::Io::Flow::V0::Models::CenterCapabilities.new(x)))
  @partner_center = (x = opts.delete(:partner_center); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PartnerCenter) ? x : ::Io::Flow::V0::Models::PartnerCenter.new(x)))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

def address
  @address
end

#capabilitiesObject (readonly)

Returns the value of attribute capabilities.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

def capabilities
  @capabilities
end

#idObject (readonly)

Returns the value of attribute id.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

def name
  @name
end

#packagingObject (readonly)

Returns the value of attribute packaging.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

def packaging
  @packaging
end

#partner_centerObject (readonly)

Returns the value of attribute partner_center.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

def partner_center
  @partner_center
end

#scheduleObject (readonly)

Returns the value of attribute schedule.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

def schedule
  @schedule
end

#servicesObject (readonly)

Returns the value of attribute services.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

def services
  @services
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

def timezone
  @timezone
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16943
16944
16945
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16943

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

#to_hashObject



16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16947

def to_hash
  {
    :id => id,
    :key => key,
    :address => address.to_hash,
    :packaging => packaging.map { |o| o.to_hash },
    :name => name,
    :services => services.map { |o| o.to_hash },
    :schedule => schedule.to_hash,
    :timezone => timezone,
    :capabilities => capabilities.nil? ? nil : capabilities.to_hash,
    :partner_center => partner_center.nil? ? nil : partner_center.to_hash
  }
end

#to_jsonObject



16939
16940
16941
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16939

def to_json
  JSON.dump(to_hash)
end