Class: PetfinderV2::Requests::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/petfinder_V2/requests/request.rb

Constant Summary collapse

BASE_URL =
'https://api.petfinder.com/v2'.freeze
COLLECTION_OPTS =
%i[
  age
  breed
  coat
  color
  gender
  organization
  size
].freeze
SINGLE_OPTS =
%i[
  distance
  limit
  location
  name
  page
  sort
  status
  type
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(access_token) ⇒ Request

Returns a new instance of Request.



29
30
31
32
# File 'lib/petfinder_V2/requests/request.rb', line 29

def initialize(access_token)
  @access_token = access_token
  @conn = Faraday.new(BASE_URL)
end

Instance Method Details

#get(path, opts = {}) ⇒ Object



34
35
36
37
38
# File 'lib/petfinder_V2/requests/request.rb', line 34

def get(path, opts = {})
  set_connection_headers
  set_connection_get_params(opts)
  @conn.get(path)
end