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.



11871
11872
11873
11874
11875
11876
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11871

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

#countObject (readonly)

Returns the value of attribute count.



11869
11870
11871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11869

def count
  @count
end

#nameObject (readonly)

Returns the value of attribute name.



11869
11870
11871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11869

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



11882
11883
11884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11882

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

#to_hashObject



11886
11887
11888
11889
11890
11891
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11886

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

#to_jsonObject



11878
11879
11880
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11878

def to_json
  JSON.dump(to_hash)
end