Class: Viki::Client
Constant Summary collapse
- HOST =
"http://www.viki.com"
Constants included from Utilities
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
Instance Method Summary collapse
-
#initialize(client_id, client_secret, host = nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(client_id, client_secret, host = nil) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 |
# File 'lib/viki/client.rb', line 12 def initialize(client_id, client_secret, host = nil) @host = host || HOST @client_id = client_id @client_secret = client_secret @access_token = auth_request(client_id, client_secret, @host) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
22 23 24 25 26 27 28 |
# File 'lib/viki/client.rb', line 22 def method_missing(name, *args) raise NoMethodError if not URL_NAMESPACES.include? name Viki::Request.new({client_id: @client_id, client_secret: @client_secret, access_token: @access_token, host: @host}, name, *args) end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
19 20 21 |
# File 'lib/viki/client.rb', line 19 def access_token @access_token end |