Class: Almodovar::HttpClient

Inherits:
Object
  • Object
show all
Defined in:
lib/almodovar/http_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHttpClient

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_typeObject

Returns the value of attribute auth_type.



6
7
8
# File 'lib/almodovar/http_client.rb', line 6

def auth_type
  @auth_type
end

#clientObject

Returns the value of attribute client.



6
7
8
# File 'lib/almodovar/http_client.rb', line 6

def client
  @client
end

#headersObject

Returns the value of attribute headers.



6
7
8
# File 'lib/almodovar/http_client.rb', line 6

def headers
  @headers
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/almodovar/http_client.rb', line 6

def password
  @password
end

#usernameObject

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