Class: DotaApiWrapper::Match
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#match_details ⇒ Object
Returns the value of attribute match_details.
-
#match_info ⇒ Object
Returns the value of attribute match_info.
Class Method Summary collapse
-
.get_matches(options = {}) ⇒ Object
Consume API wrapper to get matches.
Instance Method Summary collapse
-
#complete_details ⇒ Object
Return hash with all data from match.
-
#initialize(match_info) ⇒ Match
constructor
A new instance of Match.
-
#method_missing(name, *args, &block) ⇒ Object
If the parameter name exists in the hash, it will be returned In other case in will raise an exception ‘NoMethodError’.
Methods inherited from Base
Constructor Details
#initialize(match_info) ⇒ Match
Returns a new instance of Match.
10 11 12 13 |
# File 'lib/dota_api_wrapper/match.rb', line 10 def initialize(match_info) match_info.delete('players') @match_info = match_info end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
If the parameter name exists in the hash, it will be returned In other case in will raise an exception ‘NoMethodError’
17 18 19 20 21 22 23 24 25 |
# File 'lib/dota_api_wrapper/match.rb', line 17 def method_missing(name, *args, &block) if match_info.key?(name.to_s) match_info[name.to_s] elsif match_details.key?(name.to_s) match_details[name.to_s] else super end end |
Instance Attribute Details
#match_details ⇒ Object
Returns the value of attribute match_details.
8 9 10 |
# File 'lib/dota_api_wrapper/match.rb', line 8 def match_details @match_details end |
#match_info ⇒ Object
Returns the value of attribute match_info.
7 8 9 |
# File 'lib/dota_api_wrapper/match.rb', line 7 def match_info @match_info end |
Class Method Details
.get_matches(options = {}) ⇒ Object
Consume API wrapper to get matches
37 38 39 40 |
# File 'lib/dota_api_wrapper/match.rb', line 37 def self.get_matches( = {}) api_result = retrieve_info('/GetMatchHistory/V001', ) return api_result['result'] unless api_result.empty? end |
Instance Method Details
#complete_details ⇒ Object
Return hash with all data from match
32 33 34 |
# File 'lib/dota_api_wrapper/match.rb', line 32 def complete_details match_info.merge(match_details) end |