class Bigcartel::API

Public Class Methods

get(path, params = {}) click to toggle source
# File lib/bigcartel/api.rb, line 7
def get(path, params = {})
  normalize_response RestClient.get(api_url(path), headers.merge(params))
end
patch(path, options = {}) click to toggle source
# File lib/bigcartel/api.rb, line 11
def patch(path, options = {})
  normalize_response RestClient.patch(api_url(path), options.to_json, headers.merge(content_type: 'application/vnd.api+json', accept: 'application/vnd.api+json'))
end

Private Class Methods

api_url(path) click to toggle source
# File lib/bigcartel/api.rb, line 29
def api_url(path)
  "#{base_url}#{path}"
end
base_url() click to toggle source
# File lib/bigcartel/api.rb, line 21
def base_url
  "https://api.bigcartel.com"
end
headers() click to toggle source
# File lib/bigcartel/api.rb, line 17
def headers
  { authorization: "Bearer #{Bigcartel.api_key}" }
end
normalize_response(response) click to toggle source
# File lib/bigcartel/api.rb, line 25
def normalize_response(response)
  JSON.parse(response)
end