Class: GatherTown

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/gather_town_ruby.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(web_url, map_id: nil, test_connection: true) ⇒ GatherTown

Returns a new instance of GatherTown.



10
11
12
13
14
15
# File 'lib/gather_town_ruby.rb', line 10

def initialize(web_url, map_id: nil, test_connection: true)
  validate_web_url(web_url)
  set_space_id(web_url)
  set_map_id(map_id)
  get_map if test_connection
end

Instance Attribute Details

#map_idObject

Returns the value of attribute map_id.



8
9
10
# File 'lib/gather_town_ruby.rb', line 8

def map_id
  @map_id
end

#space_idObject (readonly)

Returns the value of attribute space_id.



7
8
9
# File 'lib/gather_town_ruby.rb', line 7

def space_id
  @space_id
end

Instance Method Details

#get_mapObject



21
22
23
24
25
# File 'lib/gather_town_ruby.rb', line 21

def get_map
  return_as_response do
    self.class.get("/getMap", **default_query_params)
  end
end

#valid_map_idsObject



17
18
19
# File 'lib/gather_town_ruby.rb', line 17

def valid_map_ids
  get_map
end