Class: KrakenClient::Requests::Base
- Inherits:
-
Object
- Object
- KrakenClient::Requests::Base
- Includes:
- Observable
- Defined in:
- lib/kraken_client/requests/base.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#endpoint_name ⇒ Object
readonly
Returns the value of attribute endpoint_name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #call(url, _endpoint_name, _options = nil) ⇒ Object
-
#initialize(config, type) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(config, type) ⇒ Base
11 12 13 14 15 |
# File 'lib/kraken_client/requests/base.rb', line 11 def initialize(config, type) @config = config @type = type add_observer(config.limiter_interface) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/kraken_client/requests/base.rb', line 9 def config @config end |
#endpoint_name ⇒ Object (readonly)
Returns the value of attribute endpoint_name.
9 10 11 |
# File 'lib/kraken_client/requests/base.rb', line 9 def endpoint_name @endpoint_name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/kraken_client/requests/base.rb', line 9 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/kraken_client/requests/base.rb', line 9 def url @url end |
Class Method Details
.build(config, type) ⇒ Object
17 18 19 20 21 |
# File 'lib/kraken_client/requests/base.rb', line 17 def self.build(config, type) type = self.type(type) "KrakenClient::Requests::#{type}".constantize.new(config, type) end |
.type(given_type) ⇒ Object
28 29 30 |
# File 'lib/kraken_client/requests/base.rb', line 28 def self.type(given_type) given_type == 'Public' ? 'Get' : 'Post' end |
Instance Method Details
#call(url, _endpoint_name, _options = nil) ⇒ Object
23 24 25 26 |
# File 'lib/kraken_client/requests/base.rb', line 23 def call(url, _endpoint_name, = nil) changed notify_observers(url.split('/').last) end |