Class: Visupedia::Api::Visu

Inherits:
Object
  • Object
show all
Defined in:
lib/visupedia/api/visu.rb

Overview

Returns an MyVisu api instance

key - The api key provided by Visupedia

Instance Method Summary collapse

Constructor Details

#initialize(key, client) ⇒ Visu

Returns a new instance of Visu.



10
11
12
13
# File 'lib/visupedia/api/visu.rb', line 10

def initialize(key, client)
  @key = key
  @client = client
end

Instance Method Details

#get(id, lang, version, options = {}) ⇒ Object

Returns all information about the wanted Visu

‘/api?key=:key&id=:id&lang=:lang&version=:version’ GET

id - The unique ID of the Visu lang - The language code wanted for the Visu version - Use a specific version of our API



22
23
24
25
26
27
28
29
# File 'lib/visupedia/api/visu.rb', line 22

def get(id, lang, version, options = {})
  body = options.fetch(:query, {})
  body[:id] = id
  body[:lang] = lang
  body[:version] = version

  @client.get("/api?key=#{@key}&id=#{id}&lang=#{lang}&version=#{version}", body, options)
end