class NerdTown::Guild

Attributes

http_connection[R]
name[R]
realm[R]

Public Class Methods

new(options) click to toggle source
# File lib/nerd_town/guild.rb, line 6
def initialize(options)
  @realm = options.fetch(:realm)
  @name = options.fetch(:name)
  @http_connection = options.fetch(:http_connection, NerdTown.configuration.http_connection)
end

Public Instance Methods

basic_info() click to toggle source
# File lib/nerd_town/guild.rb, line 19
def basic_info
  response = fetch

  response.body
end
fetch(options= '') click to toggle source
# File lib/nerd_town/guild.rb, line 25
def fetch(options= '')
  response = http_connection.get("guild/#{realm.name}/#{name}?fields=#{options}") 

  response.body
end
members() click to toggle source
# File lib/nerd_town/guild.rb, line 12
def members
  response      = fetch('members')
  rough_members = response['members']

  parse_members(rough_members)
end

Private Instance Methods

parse_members(rough_members) click to toggle source
# File lib/nerd_town/guild.rb, line 33
def parse_members(rough_members)
  MemberCollectionParser.new(rough_members).parse
end