Class: Almodovar::HttpClient
- Inherits:
-
Object
- Object
- Almodovar::HttpClient
- Defined in:
- lib/almodovar/http_client.rb
Instance Attribute Summary collapse
-
#auth_type ⇒ Object
Returns the value of attribute auth_type.
-
#client ⇒ Object
Returns the value of attribute client.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #delete(uri, query = {}, headers = {}) ⇒ Object
- #get(uri, query = {}, headers = {}) ⇒ Object
-
#initialize ⇒ HttpClient
constructor
A new instance of HttpClient.
- #post(uri, data, query = {}, headers = {}) ⇒ Object
- #put(uri, data, query = {}, headers = {}) ⇒ Object
Constructor Details
#initialize ⇒ HttpClient
Returns a new instance of HttpClient.
19 20 21 |
# File 'lib/almodovar/http_client.rb', line 19 def initialize @client = HTTPClient.new end |
Instance Attribute Details
#auth_type ⇒ Object
Returns the value of attribute auth_type.
6 7 8 |
# File 'lib/almodovar/http_client.rb', line 6 def auth_type @auth_type end |
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/almodovar/http_client.rb', line 6 def client @client end |
#headers ⇒ Object
Returns the value of attribute headers.
6 7 8 |
# File 'lib/almodovar/http_client.rb', line 6 def headers @headers end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/almodovar/http_client.rb', line 6 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/almodovar/http_client.rb', line 6 def username @username end |
Instance Method Details
#delete(uri, query = {}, headers = {}) ⇒ Object
35 36 37 |
# File 'lib/almodovar/http_client.rb', line 35 def delete(uri, query = {}, headers = {}) request(:delete, uri, query: query, headers: merge_headers(headers)) end |
#get(uri, query = {}, headers = {}) ⇒ Object
23 24 25 |
# File 'lib/almodovar/http_client.rb', line 23 def get(uri, query = {}, headers = {}) request(:get, uri, query: query, headers: merge_headers(headers)) end |
#post(uri, data, query = {}, headers = {}) ⇒ Object
27 28 29 |
# File 'lib/almodovar/http_client.rb', line 27 def post(uri, data, query = {}, headers = {}) request(:post, uri, body: data, query: query, headers: merge_headers(headers)) end |
#put(uri, data, query = {}, headers = {}) ⇒ Object
31 32 33 |
# File 'lib/almodovar/http_client.rb', line 31 def put(uri, data, query = {}, headers = {}) request(:put, uri, body: data, query: query, headers: merge_headers(headers)) end |