Class: RoomTinyManager::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/room_tiny_manager.rb

Constant Summary collapse

ROOMS_END_POINT =

FIXME: I added my access_token Can be more general, that some one use the gem can set their access token

"https://api.roomorama.com/v1.0/rooms.json"
HOST_ROOM_END_POINT =
"https://api.roomorama.com/v1.0/host/rooms.json"
ACCESS_TOKEN =
"0WGRIQTVZyf9a6kudI8zmq5QAmMCGzRlhD1jq97T54"

Instance Method Summary collapse

Constructor Details

#initialize(properties_input) ⇒ Fetcher

Returns a new instance of Fetcher.



20
21
22
# File 'lib/room_tiny_manager.rb', line 20

def initialize(properties_input)
  @properties = parse_input(properties_input)
end

Instance Method Details

#get_propertiesObject



24
25
26
# File 'lib/room_tiny_manager.rb', line 24

def get_properties
  @properties
end

#post_a_roomObject

Post new room to the following end_point “api.roomorama.com/v1.0/host/rooms.json



29
30
31
32
# File 'lib/room_tiny_manager.rb', line 29

def post_a_room
  raw_result = RestClient.get(HOST_ROOM_END_POINT, { params: @properties.first.merge(access_token: ACCESS_TOKEN) })
  JSON.parse(raw_result)
end