Class: Io::Flow::V0::Models::ServiceSummary

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

Returns a new instance of ServiceSummary.



48905
48906
48907
48908
48909
48910
48911
48912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48905

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :carrier, :name], 'ServiceSummary')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @carrier = (x = opts.delete(:carrier); x.is_a?(::Io::Flow::V0::Models::CarrierReference) ? x : ::Io::Flow::V0::Models::CarrierReference.new(x))
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @center_code = (x = opts.delete(:center_code); x.nil? ? nil : HttpClient::Preconditions.assert_class('center_code', x, String))
end

Instance Attribute Details

#carrierObject (readonly)

Returns the value of attribute carrier.



48903
48904
48905
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48903

def carrier
  @carrier
end

#center_codeObject (readonly)

Returns the value of attribute center_code.



48903
48904
48905
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48903

def center_code
  @center_code
end

#idObject (readonly)

Returns the value of attribute id.



48903
48904
48905
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48903

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



48903
48904
48905
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48903

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



48918
48919
48920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48918

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

#to_hashObject



48922
48923
48924
48925
48926
48927
48928
48929
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48922

def to_hash
  {
    :id => id,
    :carrier => carrier.to_hash,
    :name => name,
    :center_code => center_code
  }
end

#to_jsonObject



48914
48915
48916
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48914

def to_json
  JSON.dump(to_hash)
end