chatmeter 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,141 @@
1
+ module Chatmeter
2
+ class API
3
+ module Mock
4
+
5
+ # stub GET /reviewBuilder/campaign/get
6
+ Excon.stub(expects: 200, method: :get, path: '/v5/reviewBuilder/campaign/get') do |params|
7
+ {
8
+ body: {
9
+ "campaigns":[
10
+ {
11
+ "_id": {
12
+ "$oid": "574de7bfd4c6c9beb42c4c88"
13
+ },
14
+ "name": "firstCampaign",
15
+ "accountId": "56a184a6d4c61f5267b3f386",
16
+ "formId": "5743765dd4c682374d25e148",
17
+ "deliveryMethods": [
18
+ {
19
+ "type": "email",
20
+ "_id": {
21
+ "$oid": "574de7bfd4c6c9beb42c4c87"
22
+ },
23
+ "deliveryDelay": 0,
24
+ "fromAddress": "support@chatmeter.com",
25
+ "subject": "Please tell us your thoughts!",
26
+ "templateId": "5748e778d4c680e898e308a9",
27
+ "deliveryHour": nil
28
+ }
29
+ ],
30
+ "dateAdded": {
31
+ "$date": 1464723391292
32
+ },
33
+ "isActive": false,
34
+ "timeZone": "84",
35
+ "deleted": false
36
+ },
37
+ {
38
+ "_id": {
39
+ "$oid": "574de899d4c6c9beb42c4cf9"
40
+ },
41
+ "name": "newCampaign",
42
+ "accountId": "56a184a6d4c61f5267b3f386",
43
+ "formId": "5743765dd4c682374d25e148",
44
+ "deliveryMethods": [
45
+ {
46
+ "type": "email",
47
+ "_id": {
48
+ "$oid": "574de899d4c6c9beb42c4cf8"
49
+ },
50
+ "deliveryDelay": 0,
51
+ "fromAddress": "support@chatmeter.com",
52
+ "subject": "Please tell us your thoughts!",
53
+ "templateId": "57438b4dd4c66450f9866e1d",
54
+ "deliveryHour": nil
55
+ }
56
+ ],
57
+ "dateAdded": {
58
+ "$date": 1464723609260
59
+ },
60
+ "isActive": false,
61
+ "timeZone": "88",
62
+ "deleted": false
63
+ },
64
+ {
65
+ "_id": {
66
+ "$oid": "574deaadd4c6c9beb42c4d4d"
67
+ },
68
+ "name": "anotherCampaign",
69
+ "accountId": "56a184a6d4c61f5267b3f386",
70
+ "formId": "574ddfdcd4c6e2402ff37e0c",
71
+ "deliveryMethods": [
72
+ {
73
+ "type": "email",
74
+ "_id": {
75
+ "$oid": "574deaadd4c6c9beb42c4d4c"
76
+ },
77
+ "deliveryDelay": 0,
78
+ "fromAddress": "support@chatmeter.com",
79
+ "subject": "Please tell us your thoughts!",
80
+ "templateId": "5748e778d4c680e898e308a9",
81
+ "deliveryHour": nil
82
+ }
83
+ ],
84
+ "dateAdded": {
85
+ "$date": 1464724141467
86
+ },
87
+ "isActive": false,
88
+ "deleted": false
89
+ }
90
+ ]
91
+ },
92
+ status: 200
93
+ }
94
+ end
95
+
96
+ campaign_body = {
97
+ "name": "anotherCampaign",
98
+ "accountId": "56a184a6d4c61f5267b3f386",
99
+ "isActive": false,
100
+ "deliveryMethods": [
101
+ {
102
+ "deliveryDelay": 0,
103
+ "fromAddress": "support@chatmeter.com",
104
+ "subject": "Please tell us your thoughts!",
105
+ "templateId": "5748e778d4c680e898e308a9",
106
+ "type": "email",
107
+ "message": "Please tell us your thoughts! \n {{ formUrl }}"
108
+ }
109
+ ],
110
+ "formId": "574ddfdcd4c6e2402ff37e0c"
111
+ }
112
+
113
+
114
+ # stub GET /reviewBuilder/campaign/get/#{campaign_id}
115
+ Excon.stub(expects: 200, method: :get, path: %r{^/v5/reviewBuilder/campaign/get/([^/]+)$}) do |params|
116
+ request_params, mock_data = parse_stub_params(params)
117
+ {
118
+ body: campaign_body,
119
+ status: 200
120
+ }
121
+ end
122
+
123
+ # POST /reviewBuilder/campaign/create
124
+ Excon.stub(expects: 201, method: :post, path: '/v5/reviewBuilder/campaign/create') do |params|
125
+ request_params, mock_data = parse_stub_params(params)
126
+ {
127
+ body: campaign_body,
128
+ status: 201
129
+ }
130
+ end
131
+
132
+ # DELETE /reviewBuilder/campaign/delete/{campaignId}
133
+ Excon.stub(expects: 200, method: :delete, path: %r{^/v5/reviewBuilder/campaign/delete/([^/]+)$}) do |params|
134
+ request_params, mock_data = parse_stub_params(params)
135
+ {
136
+ status: 200
137
+ }
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,78 @@
1
+ module Chatmeter
2
+ class API
3
+ module Mock
4
+
5
+ # stub GET /groups
6
+ Excon.stub(expects: 200, method: :get, path: '/v5/groups') do |params|
7
+ request_params, mock_data = parse_stub_params(params)
8
+ {
9
+ body: {
10
+ "groups": [
11
+ {
12
+ "id": "406ab658-7f13-11e4-b116-123b93f75cba",
13
+ "accountId": "232",
14
+ "groupName": "Coffee shop San Diego"
15
+ }
16
+ ],
17
+ "hasMore": false
18
+ },
19
+ status: 200
20
+ }
21
+ end
22
+
23
+ # stub POST /groups
24
+ Excon.stub(expects: 200, method: :post, path: '/v5/groups') do |params|
25
+ params = JSON.parse(params[:body])
26
+
27
+ {
28
+ body: {
29
+ "id": "406ab658-7f13-11e4-b116-123b93f75cba",
30
+ "accountId": params["accountId"],
31
+ "groupName": params["groupName"],
32
+ "externalGroupId": "1x276bnh333"
33
+ },
34
+ status: 200
35
+ }
36
+ end
37
+
38
+ # stub PUT /groups/{group_id}
39
+ Excon.stub(expects: 200, method: :put, path: %r{^/v5/groups/([^/]+)$}) do |params|
40
+ params = JSON.parse(params[:body])
41
+ {
42
+ body: {
43
+ "id": "406ab658-7f13-11e4-b116-123b93f75cba",
44
+ "accountId": params["accountId"],
45
+ "groupName": params["groupName"],
46
+ "externalGroupId": "1x276bnh333"
47
+ },
48
+ status: 200
49
+ }
50
+ end
51
+
52
+ # stub DELETE /groups/{groups_id}
53
+ Excon.stub(expects: 200, method: :delete, path: %r{^/v5/groups/([^/]+)$}) do |params|
54
+ request_params, mock_data = parse_stub_params(params)
55
+ {
56
+ status: 200
57
+ }
58
+ end
59
+
60
+ # stub POST /groups/{group_id}/locations
61
+ Excon.stub(expects: 200, method: :post, path: %r{^/v5/groups/([^/]+)/locations$}) do |params|
62
+ request_params, mock_data = parse_stub_params(params)
63
+ {
64
+ status: 200
65
+ }
66
+ end
67
+
68
+ # stub DELETE /groups/{groups_id}/locations?locationIds=
69
+ Excon.stub(expects: 200, method: :delete, path: %r{^/v5/groups/([^/]+)/locations\?locationIds=\w+}) do |params|
70
+ request_params, mock_data = parse_stub_params(params)
71
+ {
72
+ status: 200
73
+ }
74
+ end
75
+
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,273 @@
1
+ module Chatmeter
2
+ class API
3
+ module Mock
4
+
5
+ # stub GET /locations
6
+ Excon.stub(expects: 200, method: :get, path: '/v5/locations') do |params|
7
+ {
8
+ body: {
9
+ "locations":[
10
+ {
11
+ "id": "392939",
12
+ "accountId": "21",
13
+ "resellerLocationId": "coffee-shop-10",
14
+ "businessName": "Coffee Shop 2",
15
+ "primaryKeyword": "Coffee",
16
+ "website": "http://www.mycoffeeshop.com",
17
+ "alternateWebsites": [
18
+ {
19
+ "website": "http://shop2.mycoffeeshop.com"
20
+ }
21
+ ],
22
+ "email": "contact@mycoffeeshop.com",
23
+ "alternateEmails": [
24
+ {
25
+ "email": "sales@mycoffeeshop.com"
26
+ }
27
+ ],
28
+ "address": {
29
+ "street": "234 Main Street",
30
+ "city": "San Diego",
31
+ "postalCode": "92101",
32
+ "state": "CA",
33
+ "country": "USA"
34
+ },
35
+ "primaryPhone": "5555551234",
36
+ "alternatePhoneNumbers": [
37
+ {
38
+ "phoneNumber": "5555552341"
39
+ }
40
+ ],
41
+ "auditOnly": false,
42
+ "brandMonitoring": {
43
+ "listingMonitoring": [
44
+ {
45
+ "name": "TenTen",
46
+ "searchCriteria": []
47
+ }
48
+ ],
49
+ "socialMonitoring": [
50
+ {
51
+ "name": "TenTen",
52
+ "searchCriteria": []
53
+ }
54
+ ]
55
+ },
56
+ "rankingKeywords": [
57
+ {
58
+ "keyword": "Coffee",
59
+ "localArea": "San Diego, CA"
60
+ }
61
+ ]
62
+ }
63
+ ],
64
+ "hasMore": true
65
+ },
66
+ status: 200
67
+ }
68
+ end
69
+
70
+
71
+ # stub GET /v5/locations/externalId/{resellerLocationId}
72
+ Excon.stub(expects: 200, method: :get, path: %r{^/v5/locations/externalId/([^/]+)$}) do |params|
73
+ request_params, mock_data = parse_stub_params(params)
74
+ {
75
+ body: [
76
+ {
77
+ "id": "217846",
78
+ "resellerLocationId": "tore",
79
+ "accountId": "56a184a6d4c61f5267b3f386",
80
+ "busName": "Apple Store",
81
+ "primaryKeyword": "Electronics Store",
82
+ "website": "https://www.apple.com/uk/retail/coventgarden/",
83
+ "alternateWebsites": [],
84
+ "email": "fraser@chatmeter.com",
85
+ "alternateEmails": [],
86
+ "address": {
87
+ "street": "1-7 The Piazza, Covent Garden",
88
+ "city": "London",
89
+ "state": "GB",
90
+ "country": "GB",
91
+ "postalCode": "WC2E 8HA"
92
+ },
93
+ "primaryPhone": "02074471400",
94
+ "alternatePhoneNumbers": [],
95
+ "auditOnly": false,
96
+ "brandMonitoring": {
97
+ "listingMonitoring": [],
98
+ "socialMonitoring": []
99
+ },
100
+ "rankingKeywords": [
101
+ {
102
+ "keyword": "iphone"
103
+ }
104
+ ],
105
+ "customListings": []
106
+ }
107
+ ],
108
+ status: 200
109
+ }
110
+ end
111
+
112
+
113
+ location_body = {
114
+ "id": "392939",
115
+ "accountId": "21",
116
+ "resellerLocationId": "coffee-shop-10",
117
+ "busName": "Coffee Shop 2",
118
+ "primaryKeyword": "Coffee",
119
+ "website": "http://www.mycoffeeshop.com",
120
+ "alternateWebsites": [
121
+ {
122
+ "website": "http://shop2.mycoffeeshop.com"
123
+ }
124
+ ],
125
+ "email": "contact@mycoffeeshop.com",
126
+ "alternateEmails": [
127
+ {
128
+ "email": "sales@mycoffeeshop.com"
129
+ }
130
+ ],
131
+ "address": {
132
+ "street": "234 Main Street",
133
+ "city": "San Diego",
134
+ "postalCode": "92101",
135
+ "state": "CA",
136
+ "country": "USA"
137
+ },
138
+ "primaryPhone": "5555551234",
139
+ "alternatePhoneNumbers": [
140
+ {
141
+ "phoneNumber": "5555552341"
142
+ }
143
+ ],
144
+ "rankingKeywords": [
145
+ {
146
+ "keyword": "Coffee",
147
+ "localArea": "San Diego, CA"
148
+ }
149
+ ],
150
+ "auditOnly": false,
151
+
152
+ "listingManagementSpecs":{
153
+ "hours":{
154
+ "Monday":{
155
+ "blocks":[
156
+
157
+ ],
158
+ "status":"Closed"
159
+ },
160
+ "Tuesday":{
161
+ "blocks":[
162
+ {
163
+ "from":"0000",
164
+ "to":"2400"
165
+ }
166
+ ],
167
+ "status":"Open"
168
+ },
169
+ "Wednesday":{
170
+ "blocks":[
171
+ {
172
+ "from":"0030",
173
+ "to":"1900"
174
+ }
175
+ ],
176
+ "status":"Open"
177
+ },
178
+ "Thursday":{
179
+ "blocks":[
180
+ {
181
+ "from":"1230",
182
+ "to":"2000"
183
+ }
184
+ ],
185
+ "status":"Open"
186
+ },
187
+ "Friday":{
188
+ "blocks":[
189
+ {
190
+ "from":"0330",
191
+ "to":"0830"
192
+ },
193
+ {
194
+ "from":"1400",
195
+ "to":"2100"
196
+ }
197
+ ],
198
+ "status":"Open"
199
+ },
200
+ "Saturday":{
201
+ "blocks":[
202
+
203
+ ],
204
+ "status":"Closed"
205
+ },
206
+ "Sunday":{
207
+ "blocks":[
208
+
209
+ ],
210
+ "status":"Closed"
211
+ }
212
+ },
213
+ "providerImages":{
214
+ "FACEBOOK":"https://cm-review-builder.s3.amazonaws.com/userImages/56a184a6d4c61f5267b3f386/e3b2883e8dfb198714fe1374f2ac55ab11f6e33dbf3f8bbd65275cda1fac7a86.jpg",
215
+ "GOOGLEMAP":"https://cm-review-builder.s3.amazonaws.com/userImages/56a184a6d4c61f5267b3f386/752a09b1af72547b47f013334609c2884e56a4f4af56bc5b96bccba1d228116c.jpg",
216
+ "TWITTER":"https://cm-review-builder.s3.amazonaws.com/userImages/56a184a6d4c61f5267b3f386/aeae7dbcea88a3e747e24b61e4688a8b3942bc3beb220c4feb181217fda075a4.jpg"
217
+ },
218
+ "hideAddress":false,
219
+ "description":"This business is pretty great, I mean, truly fantastic. You would really love this business if you came to check it out, it would really make your day awesome. Highly recommend coming to this business.",
220
+ "paymentTypes":"American Express,Cash,Check,Discover,MasterCard,Visa",
221
+ "businessOwner":"Rick",
222
+ "businessEmail":"rick@business.com",
223
+ "faxNumber":"555-555-5555",
224
+ "product":"Businesses and other things",
225
+ "brands":"Oakley, Nintendo, Dole",
226
+ "yearsInBusiness":8,
227
+ "licenseNumber":"1234556",
228
+ "linkedIn":"https://www.linkedin.com/company/bubba-bbq",
229
+ "logoUrl":"https://cm-review-builder.s3.amazonaws.com/userImages/56a184a6d4c61f5267b3f386/ee68cbc4c4374b7f2ae29e595250a5a0ff4cfbb80b64d00b9b285ae8b4d6c21c.png",
230
+ "imageUrls":[
231
+ "https://cm-review-builder.s3.amazonaws.com/userImages/56a184a6d4c61f5267b3f386/9305c42f390dbbc2e7cab50b8d9f6063cc4f37cebe49919f8eee269c53add3df.jpg",
232
+ "https://cm-review-builder.s3.amazonaws.com/userImages/56a184a6d4c61f5267b3f386/ee68cbc4c4374b7f2ae29e595250a5a0ff4cfbb80b64d00b9b285ae8b4d6c21c.png"
233
+ ]
234
+ }
235
+ }
236
+
237
+ # stub POST /locations
238
+ Excon.stub(expects: 200, method: :post, path: '/v5/locations') do |params|
239
+ request_params, mock_data = parse_stub_params(params)
240
+ {
241
+ body: location_body,
242
+ status: 200
243
+ }
244
+ end
245
+
246
+ # stub PUT /locations/{location_id}
247
+ Excon.stub(expects: 200, method: :put, path: %r{^/v5/locations/([^/]+)$}) do |params|
248
+ request_params, mock_data = parse_stub_params(params)
249
+ {
250
+ body: location_body,
251
+ status: 200
252
+ }
253
+ end
254
+
255
+ # stub DELETE /locations/{location_id}
256
+ Excon.stub(expects: 200, method: :delete, path: %r{^/v5/locations/([^/]+)$}) do |params|
257
+ request_params, mock_data = parse_stub_params(params)
258
+ {
259
+ status: 200
260
+ }
261
+ end
262
+
263
+ # stub PUT /locations/restore
264
+ Excon.stub(expects: 200, method: :put, path: %r{^/v5/locations/restore}) do |params|
265
+ request_params, mock_data = parse_stub_params(params)
266
+ {
267
+ status: 200
268
+ }
269
+ end
270
+
271
+ end
272
+ end
273
+ end
@@ -0,0 +1,18 @@
1
+ module Chatmeter
2
+ class API
3
+ module Mock
4
+
5
+ # stub POST /login
6
+ Excon.stub(:expects => 200, :method => :post, :path => '/v5/login') do |params|
7
+ {
8
+ body: '{
9
+ "username":"example",
10
+ "authenticated":true,
11
+ "token":"dsdsdsd-6760-4621-93f0-6a08e579fdvd"
12
+ }',
13
+ status: 200
14
+ }
15
+ end
16
+ end
17
+ end
18
+ end