Class: BankExchangeApi::Request::Base
- Inherits:
-
Object
- Object
- BankExchangeApi::Request::Base
show all
- Extended by:
- Param
- Defined in:
- lib/bank_exchange_api/request/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Param
param
Constructor Details
#initialize(cli, params = {}) ⇒ Base
Returns a new instance of Base.
8
9
10
11
|
# File 'lib/bank_exchange_api/request/base.rb', line 8
def initialize(cli, params={})
@cli = cli
params.each{ |k,v| public_send("#{k}=", v) }
end
|
Instance Attribute Details
#cli ⇒ Object
Returns the value of attribute cli.
6
7
8
|
# File 'lib/bank_exchange_api/request/base.rb', line 6
def cli
@cli
end
|
Instance Method Details
#endpoint ⇒ Object
29
30
31
|
# File 'lib/bank_exchange_api/request/base.rb', line 29
def endpoint
raise NotImplementedError, __method__
end
|
#get(*args) ⇒ Object
17
18
19
|
# File 'lib/bank_exchange_api/request/base.rb', line 17
def get(*args)
cli.connection.get(*args)
end
|
#json(root: nil) ⇒ Object
#params ⇒ Object
25
26
27
|
# File 'lib/bank_exchange_api/request/base.rb', line 25
def params
{}
end
|
#query ⇒ Object
13
14
15
|
# File 'lib/bank_exchange_api/request/base.rb', line 13
def query
[endpoint, URI.encode_www_form(params)].join('?')
end
|