Class: Vidalo::Connection

Inherits:
Object
  • Object
show all
Includes:
API::Get, API::Search, Parser
Defined in:
lib/vidalo/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Parser

#get_inner_text, #get_node_value

Methods included from API::Search

#search, #search_product

Methods included from API::Get

#get_number_of_products, #send_api_request

Constructor Details

#initialize(app_id, app_key) ⇒ Connection

Returns a new instance of Connection.



13
14
15
16
17
18
19
20
21
# File 'lib/vidalo/connection.rb', line 13

def initialize(app_id, app_key)
  @app_id = app_id
  @app_key = app_key
  @conn = Faraday.new(url: VIDAL_API_URL,
                      request: { params_encoder: Faraday::FlatParamsEncoder },
                      params: { app_id: app_id, app_key: app_key }) do |faraday|
                        faraday.adapter Faraday.default_adapter
                      end
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



11
12
13
# File 'lib/vidalo/connection.rb', line 11

def app_id
  @app_id
end

#app_keyObject (readonly)

Returns the value of attribute app_key.



11
12
13
# File 'lib/vidalo/connection.rb', line 11

def app_key
  @app_key
end