Class: Io::Flow::V0::Models::ItemStatistics

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Statistics covering product catalog item information, including total catalog item count, number of distinct categories, etc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ItemStatistics



16217
16218
16219
16220
16221
16222
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16217

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:items, :categories], 'ItemStatistics')
  @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Integer)
  @categories = HttpClient::Preconditions.assert_class('categories', opts.delete(:categories), Integer)
end

Instance Attribute Details

#categoriesObject (readonly)

Returns the value of attribute categories.



16215
16216
16217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16215

def categories
  @categories
end

#itemsObject (readonly)

Returns the value of attribute items.



16215
16216
16217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16215

def items
  @items
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16228
16229
16230
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16228

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

#to_hashObject



16232
16233
16234
16235
16236
16237
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16232

def to_hash
  {
    :items => items,
    :categories => categories
  }
end

#to_jsonObject



16224
16225
16226
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16224

def to_json
  JSON.dump(to_hash)
end