Class: Io::Flow::V0::Models::CategorySummary

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 = {}) ⇒ CategorySummary

Returns a new instance of CategorySummary.



11006
11007
11008
11009
11010
11011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11006

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:count], 'CategorySummary')
  @name = (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, String))
  @count = HttpClient::Preconditions.assert_class('count', opts.delete(:count), Integer)
end

Instance Attribute Details

#count ⇒ Object (readonly)

Returns the value of attribute count.



11004
11005
11006
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11004

def count
  @count
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



11004
11005
11006
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11004

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



11017
11018
11019
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11017

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

#to_hash ⇒ Object



11021
11022
11023
11024
11025
11026
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11021

def to_hash
  {
    :name => name,
    :count => count
  }
end

#to_json ⇒ Object



11013
11014
11015
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11013

def to_json
  JSON.dump(to_hash)
end