Class: Awis::Connection
- Inherits:
-
Object
- Object
- Awis::Connection
- Includes:
- Utils::Request
- Defined in:
- lib/awis/connection.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
- #params ⇒ Object
-
#protocol ⇒ Object
Returns the value of attribute protocol.
Instance Method Summary collapse
- #get(params = {}) ⇒ Object
-
#initialize ⇒ Connection
constructor
A new instance of Connection.
- #setup_options! ⇒ Object
- #setup_params(params) ⇒ Object
Methods included from Utils::Request
#algorithm, #authorization_header, #aws4, #aws4_request, #canonical_request, #credential_scope, #datestamp, #digest_sha256_hexdigest, #encryption_method, #escapeRFC3986, #handle_response, #headers, #headers_lst, #headers_str, #openssl_hmac_digest, #payload_hash, #query_str, #request, #signature, #signature_key, #signing_key, #string_to_sign, #timestamp, #uri, #url, #url_params
Constructor Details
#initialize ⇒ Connection
Returns a new instance of Connection.
8 9 10 11 12 |
# File 'lib/awis/connection.rb', line 8 def initialize raise CertificateError.new("Amazon access certificate is missing!") if Awis.config.access_key_id.nil? || Awis.config.secret_access_key.nil? end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/awis/connection.rb', line 5 def debug @debug end |
#params ⇒ Object
21 22 23 |
# File 'lib/awis/connection.rb', line 21 def params @params ||= {} end |
#protocol ⇒ Object
Returns the value of attribute protocol.
5 6 7 |
# File 'lib/awis/connection.rb', line 5 def protocol @protocol end |
Instance Method Details
#get(params = {}) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/awis/connection.rb', line 29 def get(params = {}) setup_params(params) response = handle_response(request) response.body.force_encoding(Encoding::UTF_8) end |
#setup_options! ⇒ Object
14 15 16 17 18 19 |
# File 'lib/awis/connection.rb', line 14 def @debug = Awis.config.debug || false @protocol = Awis.config.protocol || 'https' @timeout = Awis.config.timeout || 10 @open_timeout = Awis.config.open_timeout || 10 end |
#setup_params(params) ⇒ Object
25 26 27 |
# File 'lib/awis/connection.rb', line 25 def setup_params(params) self.params = params end |