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



30135
30136
30137
30138
30139
30140
30141
30142
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30135

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.



30133
30134
30135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30133

def carrier
  @carrier
end

#center_codeObject (readonly)

Returns the value of attribute center_code.



30133
30134
30135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30133

def center_code
  @center_code
end

#idObject (readonly)

Returns the value of attribute id.



30133
30134
30135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30133

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



30133
30134
30135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30133

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30148
30149
30150
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30148

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

#to_hashObject



30152
30153
30154
30155
30156
30157
30158
30159
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30152

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

#to_jsonObject



30144
30145
30146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30144

def to_json
  JSON.dump(to_hash)
end