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.



16991
16992
16993
16994
16995
16996
16997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16991

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.



16989
16990
16991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16989

def carrier
  @carrier
end

#idObject (readonly)

Returns the value of attribute id.



16989
16990
16991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16989

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



16989
16990
16991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16989

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17003
17004
17005
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17003

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

#to_hashObject



17007
17008
17009
17010
17011
17012
17013
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17007

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

#to_jsonObject



16999
17000
17001
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16999

def to_json
  JSON.dump(to_hash)
end