Class: BestbuyApi::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/bestbuy_api/model.rb

Direct Known Subclasses

Category, Product, Store

Class Method Summary collapse

Class Method Details

.attribute(id, columns = { search: false, read: true }) ⇒ Object



13
14
15
16
17
# File 'lib/bestbuy_api/model.rb', line 13

def self.attribute(id, columns = { search: false, read: true })
  row = { id => columns }
  attributes[:read].merge!(row) unless columns[:read] == false
  attributes[:search].merge!(row) unless columns[:search] == false
end

.attributesObject



5
6
7
# File 'lib/bestbuy_api/model.rb', line 5

def self.attributes
  @attributes ||= { path: nil, read: {}, search: {} }
end

.limit(args) ⇒ Object



27
28
29
# File 'lib/bestbuy_api/model.rb', line 27

def self.limit(args)
  Criteria.new(self).limit(args)
end

.page(args) ⇒ Object



31
32
33
# File 'lib/bestbuy_api/model.rb', line 31

def self.page(args)
  Criteria.new(self).page(args)
end

.path(path = nil) ⇒ Object



9
10
11
# File 'lib/bestbuy_api/model.rb', line 9

def self.path(path = nil)
  attributes[:path] = path
end

.select(*args) ⇒ Object



19
20
21
# File 'lib/bestbuy_api/model.rb', line 19

def self.select(*args)
  Criteria.new(self).select(args.uniq)
end

.where(args) ⇒ Object



23
24
25
# File 'lib/bestbuy_api/model.rb', line 23

def self.where(args)
  Criteria.new(self).where(args)
end