Class: BookingSync::API::Client

Inherits:
Object
  • Object
show all
Includes:
Bookings, Rentals
Defined in:
lib/bookingsync/api/client.rb,
lib/bookingsync/api/client/rentals.rb,
lib/bookingsync/api/client/bookings.rb

Defined Under Namespace

Modules: Bookings, Rentals

Constant Summary collapse

MEDIA_TYPE =
"application/vnd.api+json"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Rentals

#rentals

Methods included from Bookings

#bookings

Constructor Details

#initialize(token) ⇒ BookingSync::API::Client

Initialize new Client

Parameters:

  • OAuth token



19
20
21
# File 'lib/bookingsync/api/client.rb', line 19

def initialize(token)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



13
14
15
# File 'lib/bookingsync/api/client.rb', line 13

def token
  @token
end

Instance Method Details

#api_endpointString

Return API endpoint

Returns:

  • URL to API endpoint



34
35
36
# File 'lib/bookingsync/api/client.rb', line 34

def api_endpoint
  "#{base_url}/api/v3"
end

#get(path, options = {}) ⇒ Array<Sawyer::Resource>

Make a HTTP GET request

Parameters:

Returns:

  • Array of resources.



27
28
29
# File 'lib/bookingsync/api/client.rb', line 27

def get(path, options = {})
  request :get, path, options
end