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.



19920
19921
19922
19923
19924
19925
19926
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19920

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

#carrier ⇒ Object (readonly)

Returns the value of attribute carrier.



19918
19919
19920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19918

def carrier
  @carrier
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



19918
19919
19920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19918

def id
  @id
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



19918
19919
19920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19918

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19932
19933
19934
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19932

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

#to_hash ⇒ Object



19936
19937
19938
19939
19940
19941
19942
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19936

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

#to_json ⇒ Object



19928
19929
19930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19928

def to_json
  JSON.dump(to_hash)
end