class Bigcartel::BigcartelObject

Public Class Methods

all(params = {}) click to toggle source
# 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) click to toggle source
# File lib/bigcartel/bigcartel_object.rb, line 9
def find(id)
  response = Bigcartel::API.get("#{root_path}/#{id}")
  self.new(response)
end
root_path() click to toggle source
# File lib/bigcartel/bigcartel_object.rb, line 14
def root_path
  class_name = self.to_s.gsub(/^.*::/, '').downcase
  "/#{class_name}s"
end