roomorama_api 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -74,6 +74,8 @@ Currently this gem does not handle any oauth authentication yet. Host and Guest
74
74
  host_properties_update
75
75
  host_availabilities_list
76
76
  host_availabilities_update
77
+ host_inquiries_list
78
+ host_inquiries_show
77
79
 
78
80
  ### Can't find the API Call you want?
79
81
 
@@ -0,0 +1,13 @@
1
+ module RoomoramaApi
2
+ module Api
3
+ module HostInquiries
4
+ def host_inquiries_list(options={})
5
+ api_call "host/inquiries.json", options
6
+ end
7
+
8
+ def host_inquiries_show(inquiry_id, options={})
9
+ api_call "host/inquiries/#{inquiry_id}.json", options
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module RoomoramaApi
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/roomorama_api.rb CHANGED
@@ -7,6 +7,7 @@ require "roomorama_api/api/properties"
7
7
  require "roomorama_api/api/users"
8
8
  require "roomorama_api/api/host_properties"
9
9
  require "roomorama_api/api/host_availabilities"
10
+ require "roomorama_api/api/host_inquiries"
10
11
 
11
12
  require "faraday"
12
13
  require "json"
@@ -22,6 +23,7 @@ module RoomoramaApi
22
23
  include RoomoramaApi::Api::Users
23
24
  include RoomoramaApi::Api::HostProperties
24
25
  include RoomoramaApi::Api::HostAvailabilities
26
+ include RoomoramaApi::Api::HostInquiries
25
27
 
26
28
  def initialize(oauth_token=nil)
27
29
  @oauth_token = oauth_token
@@ -0,0 +1,58 @@
1
+ {
2
+ "result": [
3
+ {
4
+ "id": 9999,
5
+ "fee": 8,
6
+ "total": 58,
7
+ "state": "expired",
8
+ "check_in": "2013-10-16",
9
+ "check_out": "2013-10-17",
10
+ "num_guests": 1,
11
+ "subtotal_for_host": 50,
12
+ "total_for_host": 50,
13
+ "currency_code": "SGD",
14
+ "express_booking": false,
15
+ "url": "https://roomorama.com/host/inquiries/9999",
16
+ "created_at": "2013-07-02 01:38:46",
17
+ "updated_at": "2013-07-02 02:42:28",
18
+ "room": {
19
+ "id": 9999,
20
+ "title": "This is a test room",
21
+ "thumbnail": "https://photos.roomorama.com/photos.jpg"
22
+ },
23
+ "user": {
24
+ "id": 9999,
25
+ "display": "test_user",
26
+ "url": "https://roomorama.com/users/test_user"
27
+ }
28
+ },
29
+ {
30
+ "id": 10000,
31
+ "fee": 8,
32
+ "total": 58,
33
+ "state": "expired",
34
+ "check_in": "2013-10-16",
35
+ "check_out": "2013-10-17",
36
+ "num_guests": 1,
37
+ "subtotal_for_host": 50,
38
+ "total_for_host": 50,
39
+ "currency_code": "SGD",
40
+ "express_booking": false,
41
+ "url": "https://roomorama.com/host/inquiries/10000",
42
+ "created_at": "2013-07-02 01:38:46",
43
+ "updated_at": "2013-07-02 02:42:28",
44
+ "room": {
45
+ "id": 9999,
46
+ "title": "This is a test room",
47
+ "thumbnail": "https://photos.roomorama.com/photos.jpg"
48
+ },
49
+ "user": {
50
+ "id": 9999,
51
+ "display": "test_user",
52
+ "url": "https://roomorama.com/users/test_user"
53
+ }
54
+ }
55
+ ],
56
+ "count": 2,
57
+ "status": 200
58
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "result": {
3
+ "id": 9999,
4
+ "state": "expired",
5
+ "check_in": "2013-10-16",
6
+ "check_out": "2013-10-17",
7
+ "num_guests": 1,
8
+ "last_message": null,
9
+ "subtotal": 50,
10
+ "additional_fee": 0,
11
+ "subtotal_for_host": 50,
12
+ "total_for_host": 50,
13
+ "fee": 8,
14
+ "total": 58,
15
+ "currency_code": "SGD",
16
+ "deposit_type": "cash",
17
+ "deposit_amount": 25,
18
+ "deposit_currency_code": "USD",
19
+ "express_booking": false,
20
+ "url": "https://roomorama.com/host/inquiries/9999",
21
+ "cancellation_policy": "testing cancellation policy creation apply to all properties",
22
+ "created_at": "2013-07-02 01:38:46",
23
+ "updated_at": "2013-07-02 02:42:28",
24
+ "room": {
25
+ "id": 9999,
26
+ "title": "Test Room",
27
+ "thumbnail": "https://photos.roomorama.com/photos.jpg"
28
+ },
29
+ "user": {
30
+ "id": 9999,
31
+ "display": "test_user",
32
+ "url": "https://roomorama.com/users/test_user"
33
+ },
34
+ "messages": []
35
+ },
36
+ "status": 200
37
+ }
@@ -0,0 +1,84 @@
1
+ {
2
+ "result": {
3
+ "id": 9999,
4
+ "type": "room",
5
+ "internal_id": null,
6
+ "subtype": null,
7
+ "title": "ddgh",
8
+ "postal_code": null,
9
+ "city": "dghh",
10
+ "neighborhood": null,
11
+ "lat": "0.0",
12
+ "lng": "0.0",
13
+ "description": "dgvb",
14
+ "number_of_double_beds": null,
15
+ "number_of_single_beds": null,
16
+ "number_of_sofa_beds": null,
17
+ "surface": null,
18
+ "surface_unit": null,
19
+ "amenities": [],
20
+ "max_guests": 0,
21
+ "minimum_stay": 134,
22
+ "check_in_instructions": null,
23
+ "address": "singapore",
24
+ "apartment_number": null,
25
+ "number_of_bedrooms": null,
26
+ "number_of_bathrooms": null,
27
+ "floor": null,
28
+ "smoking_allowed": true,
29
+ "pets_allowed": false,
30
+ "children_welcome": false,
31
+ "check_in_time": null,
32
+ "check_out_time": null,
33
+ "currency_code": "SGD",
34
+ "nightly_rate": 122,
35
+ "weekly_rate": 854,
36
+ "monthly_rate": 3660,
37
+ "multi_unit": false,
38
+ "security_deposit": {
39
+ "amount": null,
40
+ "type": null,
41
+ "currency_code": null
42
+ },
43
+ "tax_rate": null,
44
+ "extra_charges": null,
45
+ "rate_base_max_guests": null,
46
+ "extra_guest_surcharge": null,
47
+ "default_to_available": true,
48
+ "cancellation_policy": null,
49
+ "terms_and_conditions": null,
50
+ "services": {
51
+ "cleaning": {
52
+ "available": null,
53
+ "rate": null,
54
+ "required": null
55
+ },
56
+ "airport_pickup": {
57
+ "available": null,
58
+ "rate": null
59
+ },
60
+ "car_rental": {
61
+ "available": null,
62
+ "rate": null
63
+ },
64
+ "concierge": {
65
+ "available": null,
66
+ "rate": null
67
+ }
68
+ },
69
+ "disabled": true,
70
+ "in_search_results": false,
71
+ "thumbnail": null,
72
+ "created_at": "2013-07-10 03:32:38",
73
+ "updated_at": "2013-08-04 04:17:17",
74
+ "destination": {
75
+ "id": 1476,
76
+ "name": "Singapore",
77
+ "long_name": "Singapore",
78
+ "url_name": "singapore",
79
+ "url_path": "singapore"
80
+ },
81
+ "units": []
82
+ },
83
+ "status": 200
84
+ }
@@ -0,0 +1,84 @@
1
+ {
2
+ "result": {
3
+ "id": 9999,
4
+ "type": "room",
5
+ "internal_id": null,
6
+ "subtype": null,
7
+ "title": "ddgh",
8
+ "postal_code": null,
9
+ "city": "dghh",
10
+ "neighborhood": null,
11
+ "lat": "0.0",
12
+ "lng": "0.0",
13
+ "description": "dgvb",
14
+ "number_of_double_beds": null,
15
+ "number_of_single_beds": null,
16
+ "number_of_sofa_beds": null,
17
+ "surface": null,
18
+ "surface_unit": null,
19
+ "amenities": [],
20
+ "max_guests": 0,
21
+ "minimum_stay": 134,
22
+ "check_in_instructions": null,
23
+ "address": "singapore",
24
+ "apartment_number": null,
25
+ "number_of_bedrooms": null,
26
+ "number_of_bathrooms": null,
27
+ "floor": null,
28
+ "smoking_allowed": true,
29
+ "pets_allowed": false,
30
+ "children_welcome": false,
31
+ "check_in_time": null,
32
+ "check_out_time": null,
33
+ "currency_code": "SGD",
34
+ "nightly_rate": 122,
35
+ "weekly_rate": 854,
36
+ "monthly_rate": 3660,
37
+ "multi_unit": false,
38
+ "security_deposit": {
39
+ "amount": null,
40
+ "type": null,
41
+ "currency_code": null
42
+ },
43
+ "tax_rate": null,
44
+ "extra_charges": null,
45
+ "rate_base_max_guests": null,
46
+ "extra_guest_surcharge": null,
47
+ "default_to_available": true,
48
+ "cancellation_policy": null,
49
+ "terms_and_conditions": null,
50
+ "services": {
51
+ "cleaning": {
52
+ "available": null,
53
+ "rate": null,
54
+ "required": null
55
+ },
56
+ "airport_pickup": {
57
+ "available": null,
58
+ "rate": null
59
+ },
60
+ "car_rental": {
61
+ "available": null,
62
+ "rate": null
63
+ },
64
+ "concierge": {
65
+ "available": null,
66
+ "rate": null
67
+ }
68
+ },
69
+ "disabled": true,
70
+ "in_search_results": false,
71
+ "thumbnail": null,
72
+ "created_at": "2013-07-10 03:32:38",
73
+ "updated_at": "2013-08-04 04:17:17",
74
+ "destination": {
75
+ "id": 1476,
76
+ "name": "Singapore",
77
+ "long_name": "Singapore",
78
+ "url_name": "singapore",
79
+ "url_path": "singapore"
80
+ },
81
+ "units": []
82
+ },
83
+ "status": 200
84
+ }
@@ -125,38 +125,60 @@ class RoomoramaApiTest < MiniTest::Unit::TestCase
125
125
  assert_equal result["result"][0]["host"]["id"], 291
126
126
  end
127
127
 
128
- #### Hosts/Properties
128
+ #### Host/Properties
129
129
 
130
- def test_hosts_properties_list
130
+ def test_host_properties_list
131
131
  stub_get("https://api.roomorama.com/v1.0/host/rooms", "hosts/properties/list.json")
132
132
  result = @client.host_properties_list
133
133
  assert_equal result["result"][0]["id"], 9999
134
134
  end
135
135
 
136
- def test_hosts_properties_show
136
+ def test_host_properties_show
137
137
  stub_get("https://api.roomorama.com/v1.0/host/rooms/9999", "hosts/properties/show.json")
138
138
  result = @client.host_properties_show 9999
139
139
  assert_equal result["result"]["id"], 9999
140
140
  end
141
141
 
142
- # def test_hosts_properties_create
143
- # end
142
+ def test_host_properties_create
143
+ stub_post("https://api.roomorama.com/v1.0/host/rooms/9999", "hosts/properties/create.json")
144
+ result = @client.host_properties_create 9999
145
+ assert_equal result["result"]["id"], 9999
146
+ end
144
147
 
145
- # def test_hosts_properties_delete
146
- # end
148
+ def test_host_properties_delete
149
+ stub_put("https://api.roomorama.com/v1.0/host/rooms/9999", "hosts/properties/update.json")
150
+ result = @client.host_properties_update 9999
151
+ assert_equal result["result"]["id"], 9999
152
+ end
153
+
154
+ #### Host/Availabilities
147
155
 
148
- def test_hosts_availabilities_list
156
+ def test_host_availabilities_list
149
157
  stub_get("https://api.roomorama.com/v1.0/host/rooms/9999/availabilities.json", "hosts/availabilities/list.json")
150
158
  result = @client.host_availabilities_list 9999
151
159
  assert_equal result["count"], 1
152
160
  end
153
161
 
154
- def test_hosts_availabilities_update
162
+ def test_host_availabilities_update
155
163
  stub_put("https://api.roomorama.com/v1.0/host/rooms/9999/availabilities.json", "hosts/availabilities/update.json")
156
164
  result = @client.host_availabilities_update 9999
157
165
  assert_equal result[0].is_a?(Hash), true
158
166
  end
159
167
 
168
+ #### Host/Inquiries
169
+
170
+ def test_host_inquiries_list
171
+ stub_get("https://api.roomorama.com/v1.0/host/inquiries.json", "hosts/inquiries/list.json")
172
+ result = @client.host_inquiries_list
173
+ assert_equal result["count"], 2
174
+ end
175
+
176
+ def test_host_inquiries_show
177
+ stub_get("https://api.roomorama.com/v1.0/host/inquiries/9999.json", "hosts/inquiries/show.json")
178
+ result = @client.host_inquiries_show 9999
179
+ assert_equal result["result"]["id"], 9999
180
+ end
181
+
160
182
  # def test_get_data_for_an_empty_property
161
183
  # assert_raises RoomoramaApi::NotFound do
162
184
  # result = @client.properties_get_data 500
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roomorama_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-21 00:00:00.000000000 Z
12
+ date: 2013-08-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -94,6 +94,7 @@ files:
94
94
  - lib/roomorama_api/api/destinations.rb
95
95
  - lib/roomorama_api/api/favorites.rb
96
96
  - lib/roomorama_api/api/host_availabilities.rb
97
+ - lib/roomorama_api/api/host_inquiries.rb
97
98
  - lib/roomorama_api/api/host_properties.rb
98
99
  - lib/roomorama_api/api/perks.rb
99
100
  - lib/roomorama_api/api/properties.rb
@@ -105,8 +106,12 @@ files:
105
106
  - test/fixtures/favorites/list.json
106
107
  - test/fixtures/hosts/availabilities/list.json
107
108
  - test/fixtures/hosts/availabilities/update.json
109
+ - test/fixtures/hosts/inquiries/list.json
110
+ - test/fixtures/hosts/inquiries/show.json
111
+ - test/fixtures/hosts/properties/create.json
108
112
  - test/fixtures/hosts/properties/list.json
109
113
  - test/fixtures/hosts/properties/show.json
114
+ - test/fixtures/hosts/properties/update.json
110
115
  - test/fixtures/perks/get_data.json
111
116
  - test/fixtures/perks/list.json
112
117
  - test/fixtures/properties/availabilities.json
@@ -152,8 +157,12 @@ test_files:
152
157
  - test/fixtures/favorites/list.json
153
158
  - test/fixtures/hosts/availabilities/list.json
154
159
  - test/fixtures/hosts/availabilities/update.json
160
+ - test/fixtures/hosts/inquiries/list.json
161
+ - test/fixtures/hosts/inquiries/show.json
162
+ - test/fixtures/hosts/properties/create.json
155
163
  - test/fixtures/hosts/properties/list.json
156
164
  - test/fixtures/hosts/properties/show.json
165
+ - test/fixtures/hosts/properties/update.json
157
166
  - test/fixtures/perks/get_data.json
158
167
  - test/fixtures/perks/list.json
159
168
  - test/fixtures/properties/availabilities.json