Class: Alexa::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/alexa/connection.rb

Constant Summary collapse

HEADERS =
{
  "Content-Type" => "application/xml",
  "Accept" => "application/xml",
  "User-Agent" => "Ruby alexa gem v#{Alexa::VERSION}"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials = {}) ⇒ Connection

Returns a new instance of Connection.



15
16
17
18
# File 'lib/alexa/connection.rb', line 15

def initialize(credentials = {})
  @secret_access_key = credentials.fetch(:secret_access_key)
  @access_key_id     = credentials.fetch(:access_key_id)
end

Instance Attribute Details

#access_key_idObject (readonly)

Returns the value of attribute access_key_id.



7
8
9
# File 'lib/alexa/connection.rb', line 7

def access_key_id
  @access_key_id
end

#paramsObject (readonly)

Returns the value of attribute params.



7
8
9
# File 'lib/alexa/connection.rb', line 7

def params
  @params
end

#secret_access_keyObject (readonly)

Returns the value of attribute secret_access_key.



7
8
9
# File 'lib/alexa/connection.rb', line 7

def secret_access_key
  @secret_access_key
end

Instance Method Details

#get(params = {}) ⇒ Object



20
21
22
23
# File 'lib/alexa/connection.rb', line 20

def get(params = {})
  @params = params
  handle_response(request).body.force_encoding(Encoding::UTF_8)
end