Class: NerdLog::Report
- Inherits:
-
Object
- Object
- NerdLog::Report
- Defined in:
- lib/nerd_log/report.rb
Instance Attribute Summary collapse
-
#guild_name ⇒ Object
readonly
Returns the value of attribute guild_name.
-
#http_connection ⇒ Object
readonly
Returns the value of attribute http_connection.
-
#realm ⇒ Object
readonly
Returns the value of attribute realm.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(options) ⇒ Report
constructor
A new instance of Report.
- #reports ⇒ Object
Constructor Details
#initialize(options) ⇒ Report
Returns a new instance of Report.
4 5 6 7 8 9 |
# File 'lib/nerd_log/report.rb', line 4 def initialize() @realm = .fetch(:realm) @guild_name = .fetch(:guild_name) @region = .fetch(:region, 'US') @http_connection = .fetch(:http_connection, NerdLog.configuration.http_connection) end |
Instance Attribute Details
#guild_name ⇒ Object (readonly)
Returns the value of attribute guild_name.
3 4 5 |
# File 'lib/nerd_log/report.rb', line 3 def guild_name @guild_name end |
#http_connection ⇒ Object (readonly)
Returns the value of attribute http_connection.
3 4 5 |
# File 'lib/nerd_log/report.rb', line 3 def http_connection @http_connection end |
#realm ⇒ Object (readonly)
Returns the value of attribute realm.
3 4 5 |
# File 'lib/nerd_log/report.rb', line 3 def realm @realm end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
3 4 5 |
# File 'lib/nerd_log/report.rb', line 3 def region @region end |
Instance Method Details
#fetch ⇒ Object
20 21 22 23 24 |
# File 'lib/nerd_log/report.rb', line 20 def fetch response = http_connection.get("reports/guild/#{guild_name}/#{realm}/#{region}") response end |
#reports ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/nerd_log/report.rb', line 11 def reports reports = [] fetch.body.each do |report| reports << OpenStruct.new(id: report['id'], title: report['title'], zone: report['zone'], start_time: report['start']) end reports end |