Class: Bookafy::BaseService
- Inherits:
-
Object
- Object
- Bookafy::BaseService
show all
- Includes:
- HTTParty
- Defined in:
- lib/bookafy/base_service.rb
Constant Summary
collapse
- API_VERSION =
'v1'
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseService.
Instance Method Details
#access_token ⇒ Object
19
20
21
|
# File 'lib/bookafy/base_service.rb', line 19
def access_token
@client_token
end
|
#bookafy_api_url ⇒ Object
15
16
17
|
# File 'lib/bookafy/base_service.rb', line 15
def bookafy_api_url
@domain
end
|
#get(url, options = {}) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/bookafy/base_service.rb', line 23
def get(url, options={})
default_options = {token: @client_token, page: 1}.merge(options)
api_url = "#{@domain}#{url}"
response = HTTParty.get(api_url, {query: default_options, headers: {'Authorization' => "Bearer #{Bookafy.access_token}"}})
response
end
|