Class: TupaloApiClient

Inherits:
Object
  • Object
show all
Includes:
APISmith::Client, TupaloApiErrors
Defined in:
lib/tupalo_api_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ TupaloApiClient

Returns a new instance of TupaloApiClient.



19
20
21
22
23
24
25
26
27
# File 'lib/tupalo_api_client.rb', line 19

def initialize(opts = {})
  options = {
    :lang => 'en',
    :token => '',
    :timeout => 15}.merge(opts)

  add_query_options! :token => options[:token] unless options[:token].empty?
  self.class.endpoint "#{options[:lang]}/api/easy/v1"
end

Instance Method Details

#match(opts = {}) ⇒ Object



41
42
43
44
# File 'lib/tupalo_api_client.rb', line 41

def match(opts={})
  transform = opts.has_key?(:spot_id) ? Match : Import
  get("match/#{parameterize(opts)}", :transform => transform)
end

#review_widget(opts = {}) ⇒ Object



37
38
39
# File 'lib/tupalo_api_client.rb', line 37

def review_widget(opts={})
  get("review_widget/#{parameterize(opts)}", :transform => ReviewWidget)
end

#spot_details(opts = {}) ⇒ Object



33
34
35
# File 'lib/tupalo_api_client.rb', line 33

def spot_details(opts={})
  get("spot/#{parameterize(opts)}", :transform => Spot)
end

#spots(opts = {}) ⇒ Object



29
30
31
# File 'lib/tupalo_api_client.rb', line 29

def spots(opts={})
  get("spots/#{parameterize(opts)}", :transform => Spot)
end