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.



22796
22797
22798
22799
22800
22801
22802
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22796

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)
end

Instance Attribute Details

#carrierObject (readonly)

Returns the value of attribute carrier.



22794
22795
22796
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22794

def carrier
  @carrier
end

#idObject (readonly)

Returns the value of attribute id.



22794
22795
22796
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22794

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



22794
22795
22796
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22794

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22808
22809
22810
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22808

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

#to_hashObject



22812
22813
22814
22815
22816
22817
22818
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22812

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

#to_jsonObject



22804
22805
22806
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22804

def to_json
  JSON.dump(to_hash)
end