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
- (BaseConnection) initialize(auth_id, auth_key, user_agent = nil)
A new instance of BaseConnection
10
11
12
13
14
15
16
17
18
|
# File 'lib/ey_api_hmac/base_connection.rb', line 10
def initialize(auth_id, auth_key, user_agent = nil)
@auth_id = auth_id
@auth_key = auth_key
@standard_headers = {
'Accept' => 'application/json',
'HTTP_DATE' => Time.now.httpdate,
'USER_AGENT' => user_agent || default_user_agent
}
end
|
Instance Attribute Details
- (Object) auth_id
Returns the value of attribute auth_id
8
9
10
|
# File 'lib/ey_api_hmac/base_connection.rb', line 8
def auth_id
@auth_id
end
|
- (Object) auth_key
Returns the value of attribute auth_key
8
9
10
|
# File 'lib/ey_api_hmac/base_connection.rb', line 8
def auth_key
@auth_key
end
|
- (Object) backend
50
51
52
|
# File 'lib/ey_api_hmac/base_connection.rb', line 50
def backend
@backend ||= Rack::Client::Handler::NetHTTP
end
|
Instance Method Details
- (Object) default_user_agent
20
21
22
|
# File 'lib/ey_api_hmac/base_connection.rb', line 20
def default_user_agent
"ApiHMAC"
end
|
- (Object) delete(url, &block)
62
63
64
|
# File 'lib/ey_api_hmac/base_connection.rb', line 62
def delete(url, &block)
request(:delete, url, &block)
end
|
- (Object) get(url, &block)
66
67
68
|
# File 'lib/ey_api_hmac/base_connection.rb', line 66
def get(url, &block)
request(:get, url, &block)
end
|
- (Object) handle_errors_with(&error_handler)
70
71
72
|
# File 'lib/ey_api_hmac/base_connection.rb', line 70
def handle_errors_with(&error_handler)
@error_handler = error_handler
end
|
- (Object) post(url, body, &block)
54
55
56
|
# File 'lib/ey_api_hmac/base_connection.rb', line 54
def post(url, body, &block)
request(:post, url, body, &block)
end
|
- (Object) put(url, body, &block)
58
59
60
|
# File 'lib/ey_api_hmac/base_connection.rb', line 58
def put(url, body, &block)
request(:put, url, body, &block)
end
|