Class: Proxima::Api
- Inherits:
-
Object
- Object
- Proxima::Api
- Defined in:
- lib/proxima/api.rb
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
readonly
Returns the value of attribute base_uri.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#ssl_context ⇒ Object
readonly
Returns the value of attribute ssl_context.
Instance Method Summary collapse
-
#initialize(base_uri, opts = {}) ⇒ Api
constructor
A new instance of Api.
- #request(method, path, opts = {}, &block) ⇒ Object
Constructor Details
#initialize(base_uri, opts = {}) ⇒ Api
Returns a new instance of Api.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/proxima/api.rb', line 7 def initialize(base_uri, opts = {}) begin @base_uri = URI.parse base_uri @http = HTTP.persistent URI.join @base_uri, "/" rescue => e raise "'#{base_uri}' is not a valid base_uri: #{e.}" end @headers = opts[:headers] || {} @ssl_context = opts[:ssl_context] end |
Instance Attribute Details
#base_uri ⇒ Object (readonly)
Returns the value of attribute base_uri.
5 6 7 |
# File 'lib/proxima/api.rb', line 5 def base_uri @base_uri end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
5 6 7 |
# File 'lib/proxima/api.rb', line 5 def headers @headers end |
#http ⇒ Object (readonly)
Returns the value of attribute http.
5 6 7 |
# File 'lib/proxima/api.rb', line 5 def http @http end |
#ssl_context ⇒ Object (readonly)
Returns the value of attribute ssl_context.
5 6 7 |
# File 'lib/proxima/api.rb', line 5 def ssl_context @ssl_context end |