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.



60508
60509
60510
60511
60512
60513
60514
60515
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60508

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.



60506
60507
60508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60506

def carrier
  @carrier
end

#center_codeObject (readonly)

Returns the value of attribute center_code.



60506
60507
60508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60506

def center_code
  @center_code
end

#idObject (readonly)

Returns the value of attribute id.



60506
60507
60508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60506

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



60506
60507
60508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60506

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



60521
60522
60523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60521

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

#to_hashObject



60525
60526
60527
60528
60529
60530
60531
60532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60525

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

#to_jsonObject



60517
60518
60519
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60517

def to_json
  JSON.dump(to_hash)
end