Class: EY::ApiHMAC::BaseConnection
- Inherits:
-
Object
- Object
- EY::ApiHMAC::BaseConnection
show all
- Defined in:
- lib/ey_api_hmac/base_connection.rb
Defined Under Namespace
Classes: NotFound, UnknownError, ValidationError
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(user_agent = nil) ⇒ BaseConnection
Returns a new instance of BaseConnection.
12
13
14
15
16
17
18
19
|
# File 'lib/ey_api_hmac/base_connection.rb', line 12
def initialize(user_agent = nil)
@standard_headers = {
'Accept' => 'application/json',
'HTTP_DATE' => Time.now.httpdate,
'USER_AGENT' => user_agent || default_user_agent
}
self.middlewares = [Rack::Idempotent]
end
|
Instance Attribute Details
#backend ⇒ Object
54
55
56
|
# File 'lib/ey_api_hmac/base_connection.rb', line 54
def backend
@backend ||= Rack::Client::Handler::NetHTTP
end
|
#middlewares ⇒ Object
Returns the value of attribute middlewares.
10
11
12
|
# File 'lib/ey_api_hmac/base_connection.rb', line 10
def middlewares
@middlewares
end
|
Instance Method Details
#default_user_agent ⇒ Object
21
22
23
|
# File 'lib/ey_api_hmac/base_connection.rb', line 21
def default_user_agent
"ApiHMAC"
end
|
#delete(url, &block) ⇒ Object
66
67
68
|
# File 'lib/ey_api_hmac/base_connection.rb', line 66
def delete(url, &block)
request(:delete, url, &block)
end
|
#get(url, body = nil, &block) ⇒ Object
70
71
72
|
# File 'lib/ey_api_hmac/base_connection.rb', line 70
def get(url, body = nil, &block)
request(:get, url, body, &block)
end
|
#handle_errors_with(&error_handler) ⇒ Object
74
75
76
|
# File 'lib/ey_api_hmac/base_connection.rb', line 74
def handle_errors_with(&error_handler)
@error_handler = error_handler
end
|
#post(url, body, &block) ⇒ Object
58
59
60
|
# File 'lib/ey_api_hmac/base_connection.rb', line 58
def post(url, body, &block)
request(:post, url, body, &block)
end
|
#put(url, body, &block) ⇒ Object
62
63
64
|
# File 'lib/ey_api_hmac/base_connection.rb', line 62
def put(url, body, &block)
request(:put, url, body, &block)
end
|