Class: WargamingApi::Base
- Includes:
- Util::Http, Util::Params, Util::Uri
- Defined in:
- lib/wargaming_api/base.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Attributes inherited from Node
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
Methods included from Util::Http
Methods included from Util::Params
Methods included from Util::Uri
Methods inherited from Node
#define_array, #initialize_as_array, #initialize_as_hash, #initialize_attributes
Methods included from Concern::Attributable
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 |
# File 'lib/wargaming_api/base.rb', line 10 def initialize(params = {}) @params = prepare_params(params) @uri = api_uri(@params) @json = fetch_data(@uri).with_indifferent_access super(@json[:data]) end |
Instance Attribute Details
#json ⇒ Object (readonly)
Returns the value of attribute json.
8 9 10 |
# File 'lib/wargaming_api/base.rb', line 8 def json @json end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/wargaming_api/base.rb', line 6 def params @params end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
7 8 9 |
# File 'lib/wargaming_api/base.rb', line 7 def uri @uri end |
Class Method Details
.fetch(params = {}) ⇒ Object
17 18 19 |
# File 'lib/wargaming_api/base.rb', line 17 def self.fetch(params = {}) self.new(params) end |