Class: PQSDK::Brand
- Inherits:
-
RemoteObject
- Object
- RemoteObject
- PQSDK::Brand
- Defined in:
- lib/pqsdk/brand.rb
Overview
The Brand class provides an interface for crawlers to the v1/brands api endpoint.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#slug ⇒ Object
Returns the value of attribute slug.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from RemoteObject
all, #create, #create!, from_hash, get, #persisted?, #save, #save!, #update, #update!
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/pqsdk/brand.rb', line 9 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/pqsdk/brand.rb', line 9 def name @name end |
#slug ⇒ Object
Returns the value of attribute slug.
9 10 11 |
# File 'lib/pqsdk/brand.rb', line 9 def slug @slug end |
Class Method Details
.find(name) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pqsdk/brand.rb', line 19 def self.find(name) res = RestLayer.get("#{@endpoint}/search", q: name) if res[0] == 200 from_hash res[1] elsif res[0] == 404 nil else raise "Unexpected HTTP status code #{res[0]}, #{res[1]}" end end |
.list ⇒ Object
15 16 17 |
# File 'lib/pqsdk/brand.rb', line 15 def self.list all # aliased until all crawlers use .all end |
Instance Method Details
#attributes ⇒ Object
11 12 13 |
# File 'lib/pqsdk/brand.rb', line 11 def attributes { 'name' => nil, 'slug' => nil } end |