lib/buckybox/api.rb in buckybox-api-1.5.0 vs lib/buckybox/api.rb in buckybox-api-1.6.0

- old
+ new

@@ -6,10 +6,16 @@ module BuckyBox class API ResponseError = Class.new(Exception) # generic error NotFoundError = Class.new(Exception) + ENDPOINTS = { + production: "https://api.buckybox.com/v1", + staging: "https://api-staging.buckybox.com/v1", + development: "http://api.buckybox.local:3000/v1", + }.freeze + class CachedResponse attr_reader :response, :cached_at def initialize(response) @response, @cached_at = response, epoch @@ -24,10 +30,10 @@ end end include HTTParty format :json - base_uri "https://api.buckybox.com/v1" + base_uri ENDPOINTS.fetch(ENV.fetch("RAILS_ENV", "development").to_sym) def initialize(headers) self.class.headers(headers) end