Class: Bigcartel::BigcartelObject
- Inherits:
-
RecursiveOpenStruct
- Object
- RecursiveOpenStruct
- Bigcartel::BigcartelObject
- Defined in:
- lib/bigcartel/bigcartel_object.rb
Class Method Summary collapse
Class Method Details
.all(params = {}) ⇒ Object
4 5 6 7 |
# File 'lib/bigcartel/bigcartel_object.rb', line 4 def all(params = {}) resp = Bigcartel::API.get(root_path, params: params) resp['data'].map { |object| self.new(object) } end |
.find(id) ⇒ Object
9 10 11 12 |
# File 'lib/bigcartel/bigcartel_object.rb', line 9 def find(id) response = Bigcartel::API.get("#{root_path}/#{id}") self.new(response) end |
.root_path ⇒ Object
14 15 16 17 |
# File 'lib/bigcartel/bigcartel_object.rb', line 14 def root_path class_name = self.to_s.gsub(/^.*::/, '').downcase "/#{class_name}s" end |