class NerdLog::Encounter

Attributes

http_connection[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/nerd_log/encounter.rb, line 6
def initialize(options = {})
  @http_connection = options.fetch(:http_connection, NerdLog.configuration.http_connection)
end

Public Instance Methods

encounters() click to toggle source
# File lib/nerd_log/encounter.rb, line 10
def encounters
  encounters = []

  fetch.body.each do |zone|
    zone['encounters'].each do |encounter|
      encounters << OpenStruct.new(zone_id: zone['id'],
                                   id: encounter['id'],
                                   name: encounter['name'])
    end
  end
  encounters
end
fetch() click to toggle source
# File lib/nerd_log/encounter.rb, line 23
def fetch
  response = http_connection.get("zones")

  response
end