bluekai 0.0.1 → 0.0.2

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/lib/bluekai/category.rb +145 -0
  4. data/lib/bluekai/client.rb +20 -321
  5. data/lib/bluekai/rule.rb +165 -0
  6. data/lib/bluekai/user_data.rb +90 -0
  7. data/lib/bluekai/version.rb +1 -1
  8. data/lib/bluekai.rb +3 -0
  9. data/spec/fixtures/signatures/0e01a80ff1ca77f4fd32b58ff48310168539a9a26e4ef527042b7bab78d4648a +1 -0
  10. data/spec/fixtures/signatures/7fe2b3662915bf82890e1fe870480885e0744b12832569c5d7017a0fc42d5527 +1 -0
  11. data/spec/fixtures/signatures/8cd7ba76199d2b34be042841a2dd69310619dcac0f3dd4f24bae6b5fb5f9e302 +1 -0
  12. data/spec/fixtures/signatures/95768bffa5416007061da13a2a0368e52a4bea3451ac2dfede43f6a6841ac402 +1 -0
  13. data/spec/fixtures/vcr_cassettes/{Bluekai_Client → Bluekai_Category}/creates_a_category.yml +10 -10
  14. data/spec/fixtures/vcr_cassettes/Bluekai_Category/lists_4_categories.yml +104 -0
  15. data/spec/fixtures/vcr_cassettes/{Bluekai_Client → Bluekai_Category}/reads_a_category_and_its_reach.yml +1616 -1610
  16. data/spec/fixtures/vcr_cassettes/{Bluekai_Client → Bluekai_Category}/updates_a_category.yml +9 -9
  17. data/spec/fixtures/vcr_cassettes/Bluekai_Client/lists_Bluekai_taxonomy_nodes.yml +28225 -27370
  18. data/spec/fixtures/vcr_cassettes/Bluekai_Client/performs_a_ping.yml +4 -4
  19. data/spec/fixtures/vcr_cassettes/{Bluekai_Client → Bluekai_Rule}/creates_a_rule.yml +11 -11
  20. data/spec/fixtures/vcr_cassettes/Bluekai_Rule/lists_10_phint_rules.yml +234 -0
  21. data/spec/fixtures/vcr_cassettes/{Bluekai_Client → Bluekai_Rule}/reads_a_rule.yml +12 -10
  22. data/spec/fixtures/vcr_cassettes/{Bluekai_Client → Bluekai_Rule}/updates_a_rule.yml +7 -7
  23. data/spec/fixtures/vcr_cassettes/Bluekai_UserData/reads_user_information_given_bkuuid.yml +44 -0
  24. data/spec/lib/bluekai/category_integration_spec.rb +56 -0
  25. data/spec/lib/bluekai/client_integration_spec.rb +1 -141
  26. data/spec/lib/bluekai/client_spec.rb +0 -3
  27. data/spec/lib/bluekai/rule_integration_spec.rb +73 -0
  28. data/spec/lib/bluekai/user_data_integration_spec.rb +12 -0
  29. data/spec/spec_helper.rb +3 -2
  30. data/spec/support/signature_mock.rb +13 -0
  31. metadata +40 -19
  32. data/spec/fixtures/vcr_cassettes/Bluekai_Client/lists_10_phint_rules.yml +0 -194
  33. data/spec/fixtures/vcr_cassettes/Bluekai_Client/lists_4_categories.yml +0 -3569
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://bluekai-domain.com/Services/WS/Ping?bksig=JdjkHEEhF0deJhXg8GSiRUuT5L/vpeYuxf3NTPgzYyM=&bkuid=bluekai-api-user-key
5
+ uri: https://services.bluekai.com/Services/WS/Ping?bksig=JdjkHEEhF0deJhXg8GSiRUuT5L/vpeYuxf3NTPgzYyM=&bkuid=bluekai-api-user-key
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -19,9 +19,9 @@ http_interactions:
19
19
  message: OK
20
20
  headers:
21
21
  Date:
22
- - Wed, 08 Apr 2015 07:33:30 GMT
22
+ - Tue, 14 Apr 2015 11:44:13 GMT
23
23
  Set-Cookie:
24
- - JSESSIONID=6B84C4036E88162F522EB8CE2EECDEB7; Path=/Services; HttpOnly
24
+ - JSESSIONID=62664844E0CF5F26EFF22B12FB79B3FC; Path=/Services; HttpOnly
25
25
  Content-Length:
26
26
  - '0'
27
27
  Nncoection:
@@ -32,5 +32,5 @@ http_interactions:
32
32
  encoding: UTF-8
33
33
  string: ''
34
34
  http_version:
35
- recorded_at: Wed, 08 Apr 2015 07:33:30 GMT
35
+ recorded_at: Tue, 14 Apr 2015 11:44:13 GMT
36
36
  recorded_with: VCR 2.9.3
@@ -2,10 +2,10 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://bluekai-domain.com/Services/WS/classificationRules?bksig=4EP5gTMcv7xfptkcK/fQpEEH9Qtxtta879BfAGEvxfM=&bkuid=bluekai-api-user-key
5
+ uri: https://services.bluekai.com/Services/WS/classificationRules?bksig=/OMmOpBsb88KpnipB5og6HaMrTjXEjNPDYuwLoTEgT0=&bkuid=bluekai-api-user-key
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"category_ids":[421262],"name":"CONVERSION_TEST_123","partner_id":"bluekai-partner-id","phints":[{"key":"offer_id","value":321,"operator":"is"}],"site_ids":[23705],"type":"phint"}'
8
+ string: '{"category_ids":[421262],"name":"CONVERSION_TEST_1234","partner_id":"bluekai-partner-id","phints":[{"key":"offer_id","value":321,"operator":"is"}],"site_ids":[23705],"type":"phint"}'
9
9
  headers:
10
10
  Accept:
11
11
  - application/json
@@ -17,9 +17,9 @@ http_interactions:
17
17
  message: OK
18
18
  headers:
19
19
  Date:
20
- - Tue, 07 Apr 2015 14:59:35 GMT
20
+ - Wed, 15 Apr 2015 09:41:09 GMT
21
21
  Set-Cookie:
22
- - JSESSIONID=662EF05C59346A4140D7EEF2B73F517B; Path=/Services; HttpOnly
22
+ - JSESSIONID=56BBF67A43B0CC022206B5BA2634337B; Path=/Services; HttpOnly
23
23
  Content-Type:
24
24
  - application/json
25
25
  Cneonction:
@@ -30,28 +30,28 @@ http_interactions:
30
30
  encoding: UTF-8
31
31
  string: |-
32
32
  {
33
- "name" : "CONVERSION_TEST_123",
34
- "id" : 12492,
33
+ "name" : "CONVERSION_TEST_1234",
34
+ "id" : 15330,
35
35
  "type" : "phint",
36
36
  "status" : "active",
37
37
  "phints" : [ {
38
- "id" : 16552,
38
+ "id" : 24110,
39
39
  "key" : "offer_id",
40
40
  "value" : "321",
41
41
  "operator" : "is"
42
42
  } ],
43
- "partner_id" : bluekai-partner-id,
44
- "created_at" : "Tue Apr 07 09:59:35 CDT 2015",
45
- "updated_at" : "Tue Apr 07 09:59:35 CDT 2015",
46
43
  "categories" : [ {
47
44
  "id" : 421262,
48
45
  "name" : "Action"
49
46
  } ],
47
+ "partner_id" : bluekai-partner-id,
48
+ "created_at" : "Wed Apr 15 04:41:09 CDT 2015",
49
+ "updated_at" : "Wed Apr 15 04:41:09 CDT 2015",
50
50
  "sites" : [ {
51
51
  "id" : 23705,
52
52
  "name" : "Cake - Data Collection Tag"
53
53
  } ]
54
54
  }
55
55
  http_version:
56
- recorded_at: Tue, 07 Apr 2015 14:59:48 GMT
56
+ recorded_at: Wed, 15 Apr 2015 09:41:25 GMT
57
57
  recorded_with: VCR 2.9.3
@@ -0,0 +1,234 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://services.bluekai.com/Services/WS/classificationRules?bksig=25svR0EJNGSFWHQ/Fh/FsenidKnTBrlDH1%2BpDbw5nGw=&bkuid=bluekai-api-user-key&offset=0&size=10&type=phint
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Date:
16
+ - Tue, 14 Apr 2015 11:56:35 GMT
17
+ Set-Cookie:
18
+ - JSESSIONID=294CB9392A1575B38537A94CE2F28CFE; Path=/Services; HttpOnly
19
+ Content-Type:
20
+ - application/json
21
+ Cneonction:
22
+ - close
23
+ Transfer-Encoding:
24
+ - chunked
25
+ body:
26
+ encoding: UTF-8
27
+ string: |-
28
+ {
29
+ "rules" : [ {
30
+ "name" : "CLICK_ALL",
31
+ "id" : 15306,
32
+ "type" : "phint",
33
+ "status" : "active",
34
+ "phints" : [ {
35
+ "id" : 24087,
36
+ "key" : "event",
37
+ "value" : "click",
38
+ "operator" : "is"
39
+ } ],
40
+ "partner_id" : bluekai-partner-id,
41
+ "site_ids" : [ 23705 ],
42
+ "created_at" : "Mon Apr 13 13:06:57 EDT 2015",
43
+ "updated_at" : "Mon Apr 13 13:06:57 EDT 2015",
44
+ "category_ids" : [ 425170 ]
45
+ }, {
46
+ "name" : "CAKE_CLICK",
47
+ "id" : 15304,
48
+ "type" : "phint",
49
+ "status" : "active",
50
+ "phints" : [ {
51
+ "id" : 24084,
52
+ "key" : "event",
53
+ "value" : "click",
54
+ "operator" : "is"
55
+ } ],
56
+ "partner_id" : bluekai-partner-id,
57
+ "site_ids" : [ 23705 ],
58
+ "created_at" : "Mon Apr 13 06:56:33 EDT 2015",
59
+ "updated_at" : "Mon Apr 13 06:56:33 EDT 2015",
60
+ "category_ids" : [ 425170 ]
61
+ }, {
62
+ "name" : "CLICK_MMORPG_9802",
63
+ "id" : 15303,
64
+ "type" : "phint",
65
+ "status" : "active",
66
+ "phints" : [ {
67
+ "id" : 24082,
68
+ "key" : "offer_id",
69
+ "value" : "9802",
70
+ "operator" : "is"
71
+ }, {
72
+ "id" : 24083,
73
+ "key" : "event",
74
+ "value" : "click",
75
+ "operator" : "is"
76
+ } ],
77
+ "partner_id" : bluekai-partner-id,
78
+ "site_ids" : [ 23705 ],
79
+ "created_at" : "Mon Apr 13 06:00:32 EDT 2015",
80
+ "updated_at" : "Mon Apr 13 06:00:32 EDT 2015",
81
+ "category_ids" : [ 425173 ]
82
+ }, {
83
+ "name" : "CLICK_ACTION_MMORPG_10978",
84
+ "id" : 15302,
85
+ "type" : "phint",
86
+ "status" : "active",
87
+ "phints" : [ {
88
+ "id" : 24080,
89
+ "key" : "offer_id",
90
+ "value" : "10978",
91
+ "operator" : "is"
92
+ }, {
93
+ "id" : 24081,
94
+ "key" : "event",
95
+ "value" : "click",
96
+ "operator" : "is"
97
+ } ],
98
+ "partner_id" : bluekai-partner-id,
99
+ "site_ids" : [ 23705 ],
100
+ "created_at" : "Mon Apr 13 06:00:29 EDT 2015",
101
+ "updated_at" : "Mon Apr 13 06:00:29 EDT 2015",
102
+ "category_ids" : [ 425171, 425173 ]
103
+ }, {
104
+ "name" : "CLICK_CASUAL_SIMULATION_11069",
105
+ "id" : 15301,
106
+ "type" : "phint",
107
+ "status" : "active",
108
+ "phints" : [ {
109
+ "id" : 24078,
110
+ "key" : "offer_id",
111
+ "value" : "11069",
112
+ "operator" : "is"
113
+ }, {
114
+ "id" : 24079,
115
+ "key" : "event",
116
+ "value" : "click",
117
+ "operator" : "is"
118
+ } ],
119
+ "partner_id" : bluekai-partner-id,
120
+ "site_ids" : [ 23705 ],
121
+ "created_at" : "Mon Apr 13 06:00:28 EDT 2015",
122
+ "updated_at" : "Mon Apr 13 06:00:28 EDT 2015",
123
+ "category_ids" : [ 425174, 425172 ]
124
+ }, {
125
+ "name" : "CLICK_CASUAL_SIMULATION_11068",
126
+ "id" : 15300,
127
+ "type" : "phint",
128
+ "status" : "active",
129
+ "phints" : [ {
130
+ "id" : 24076,
131
+ "key" : "offer_id",
132
+ "value" : "11068",
133
+ "operator" : "is"
134
+ }, {
135
+ "id" : 24077,
136
+ "key" : "event",
137
+ "value" : "click",
138
+ "operator" : "is"
139
+ } ],
140
+ "partner_id" : bluekai-partner-id,
141
+ "site_ids" : [ 23705 ],
142
+ "created_at" : "Mon Apr 13 06:00:28 EDT 2015",
143
+ "updated_at" : "Mon Apr 13 06:00:28 EDT 2015",
144
+ "category_ids" : [ 425172, 425174 ]
145
+ }, {
146
+ "name" : "CLICK_MMORPG_11045",
147
+ "id" : 15299,
148
+ "type" : "phint",
149
+ "status" : "active",
150
+ "phints" : [ {
151
+ "id" : 24074,
152
+ "key" : "offer_id",
153
+ "value" : "11045",
154
+ "operator" : "is"
155
+ }, {
156
+ "id" : 24075,
157
+ "key" : "event",
158
+ "value" : "click",
159
+ "operator" : "is"
160
+ } ],
161
+ "partner_id" : bluekai-partner-id,
162
+ "site_ids" : [ 23705 ],
163
+ "created_at" : "Mon Apr 13 06:00:28 EDT 2015",
164
+ "updated_at" : "Mon Apr 13 06:00:28 EDT 2015",
165
+ "category_ids" : [ 425173 ]
166
+ }, {
167
+ "name" : "CLICK_ACTION_MMORPG_10979",
168
+ "id" : 15298,
169
+ "type" : "phint",
170
+ "status" : "active",
171
+ "phints" : [ {
172
+ "id" : 24072,
173
+ "key" : "offer_id",
174
+ "value" : "10979",
175
+ "operator" : "is"
176
+ }, {
177
+ "id" : 24073,
178
+ "key" : "event",
179
+ "value" : "click",
180
+ "operator" : "is"
181
+ } ],
182
+ "partner_id" : bluekai-partner-id,
183
+ "site_ids" : [ 23705 ],
184
+ "created_at" : "Mon Apr 13 06:00:24 EDT 2015",
185
+ "updated_at" : "Mon Apr 13 06:00:24 EDT 2015",
186
+ "category_ids" : [ 425171, 425173 ]
187
+ }, {
188
+ "name" : "CLICK_MMORPG_SIMULATION_9465",
189
+ "id" : 15297,
190
+ "type" : "phint",
191
+ "status" : "active",
192
+ "phints" : [ {
193
+ "id" : 24070,
194
+ "key" : "offer_id",
195
+ "value" : "9465",
196
+ "operator" : "is"
197
+ }, {
198
+ "id" : 24071,
199
+ "key" : "event",
200
+ "value" : "click",
201
+ "operator" : "is"
202
+ } ],
203
+ "partner_id" : bluekai-partner-id,
204
+ "site_ids" : [ 23705 ],
205
+ "created_at" : "Mon Apr 13 06:00:23 EDT 2015",
206
+ "updated_at" : "Mon Apr 13 06:00:23 EDT 2015",
207
+ "category_ids" : [ 425173, 425174 ]
208
+ }, {
209
+ "name" : "CLICK_MMORPG_SIMULATION_9454",
210
+ "id" : 15296,
211
+ "type" : "phint",
212
+ "status" : "active",
213
+ "phints" : [ {
214
+ "id" : 24068,
215
+ "key" : "offer_id",
216
+ "value" : "9454",
217
+ "operator" : "is"
218
+ }, {
219
+ "id" : 24069,
220
+ "key" : "event",
221
+ "value" : "click",
222
+ "operator" : "is"
223
+ } ],
224
+ "partner_id" : bluekai-partner-id,
225
+ "site_ids" : [ 23705 ],
226
+ "created_at" : "Mon Apr 13 06:00:22 EDT 2015",
227
+ "updated_at" : "Mon Apr 13 06:00:22 EDT 2015",
228
+ "category_ids" : [ 425173, 425174 ]
229
+ } ],
230
+ "total_count" : 4201
231
+ }
232
+ http_version:
233
+ recorded_at: Tue, 14 Apr 2015 11:56:37 GMT
234
+ recorded_with: VCR 2.9.3
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://bluekai-domain.com/Services/WS/classificationRules/10380?bksig=NcegM6j6CXThFfxrXyjWoXeIi3RoARMRCqX2Co%2B%2BCsQ=&bkuid=bluekai-api-user-key
5
+ uri: https://services.bluekai.com/Services/WS/classificationRules/10380?bksig=NcegM6j6CXThFfxrXyjWoXeIi3RoARMRCqX2Co%2B%2BCsQ=&bkuid=bluekai-api-user-key
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -13,9 +13,9 @@ http_interactions:
13
13
  message: OK
14
14
  headers:
15
15
  Date:
16
- - Tue, 07 Apr 2015 14:59:48 GMT
16
+ - Tue, 14 Apr 2015 11:56:34 GMT
17
17
  Set-Cookie:
18
- - JSESSIONID=930E123268B67F2E8FA1DD22E61A4024; Path=/Services; HttpOnly
18
+ - JSESSIONID=2B09EBAE5689B9A75A9774E22CA40008; Path=/Services; HttpOnly
19
19
  Content-Type:
20
20
  - application/json
21
21
  Cneonction:
@@ -35,10 +35,15 @@ http_interactions:
35
35
  "key" : "offer_id",
36
36
  "value" : "9126",
37
37
  "operator" : "is"
38
+ }, {
39
+ "id" : 17150,
40
+ "key" : "event",
41
+ "value" : "conversion",
42
+ "operator" : "is"
38
43
  } ],
39
44
  "partner_id" : bluekai-partner-id,
40
- "created_at" : "Thu Apr 02 09:50:57 CDT 2015",
41
- "updated_at" : "Thu Apr 02 09:50:57 CDT 2015",
45
+ "created_at" : "Thu Apr 02 09:50:57 EDT 2015",
46
+ "updated_at" : "Mon Apr 13 01:49:00 EDT 2015",
42
47
  "categories" : [ {
43
48
  "id" : 421427,
44
49
  "name" : "Simulation"
@@ -46,11 +51,8 @@ http_interactions:
46
51
  "id" : 421262,
47
52
  "name" : "Action"
48
53
  } ],
49
- "sites" : [ {
50
- "id" : 23705,
51
- "name" : "Cake - Data Collection Tag"
52
- } ]
54
+ "sites" : [ ]
53
55
  }
54
56
  http_version:
55
- recorded_at: Tue, 07 Apr 2015 14:59:49 GMT
57
+ recorded_at: Tue, 14 Apr 2015 11:56:35 GMT
56
58
  recorded_with: VCR 2.9.3
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: put
5
- uri: https://bluekai-domain.com/Services/WS/classificationRules/12490?bksig=C5k49xPl8GSTb3AfU9ICjyo5rgDFRyF3DCAzHrG7QQs=&bkuid=bluekai-api-user-key
5
+ uri: https://services.bluekai.com/Services/WS/classificationRules/12490?bksig=C5k49xPl8GSTb3AfU9ICjyo5rgDFRyF3DCAzHrG7QQs=&bkuid=bluekai-api-user-key
6
6
  body:
7
7
  encoding: UTF-8
8
8
  string: '{"category_ids":[421262],"name":"CONVERSION_TEST_321","partner_id":"bluekai-partner-id","phints":[{"key":"offer_id","value":321,"operator":"contains"}],"site_ids":[23705],"type":"phint"}'
@@ -17,9 +17,9 @@ http_interactions:
17
17
  message: OK
18
18
  headers:
19
19
  Date:
20
- - Tue, 07 Apr 2015 14:59:47 GMT
20
+ - Tue, 14 Apr 2015 11:56:33 GMT
21
21
  Set-Cookie:
22
- - JSESSIONID=9EF5CCE41946BA0101768D0ED2A19FE7; Path=/Services; HttpOnly
22
+ - JSESSIONID=C1B7430DC0BC33C342A8540F6E8095A7; Path=/Services; HttpOnly
23
23
  Content-Type:
24
24
  - application/json
25
25
  Cneonction:
@@ -35,14 +35,14 @@ http_interactions:
35
35
  "type" : "phint",
36
36
  "status" : "active",
37
37
  "phints" : [ {
38
- "id" : 16543,
38
+ "id" : 24099,
39
39
  "key" : "offer_id",
40
40
  "value" : "321",
41
41
  "operator" : "contains"
42
42
  } ],
43
43
  "partner_id" : bluekai-partner-id,
44
- "created_at" : "Tue Apr 07 07:29:29 CDT 2015",
45
- "updated_at" : "Tue Apr 07 09:59:47 CDT 2015",
44
+ "created_at" : "Tue Apr 07 07:29:29 EDT 2015",
45
+ "updated_at" : "Tue Apr 14 07:56:33 EDT 2015",
46
46
  "categories" : [ {
47
47
  "id" : 421262,
48
48
  "name" : "Action"
@@ -53,5 +53,5 @@ http_interactions:
53
53
  } ]
54
54
  }
55
55
  http_version:
56
- recorded_at: Tue, 07 Apr 2015 14:59:48 GMT
56
+ recorded_at: Tue, 14 Apr 2015 11:56:34 GMT
57
57
  recorded_with: VCR 2.9.3
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.tags.bluekai.com/getdata/16161/v1.2?bksig=6yKY4ELmcOD1mWIoiTNkfeNKtA6P6UlUH0tnW2DuYvk=&bkuid=bluekai-api-user-key&userid=9BKOJXy999OyJaaD
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Date:
16
+ - Tue, 14 Apr 2015 11:33:03 GMT
17
+ Server:
18
+ - Apache/2.2.24 (Unix)
19
+ P3p:
20
+ - CP="NOI DSP COR CUR ADMo DEVo PSAo PSDo OUR SAMo BUS UNI NAV", policyref="http://tags.bluekai.com/w3c/p3p.xml"
21
+ Pragma:
22
+ - no-cache
23
+ Expires:
24
+ - Thu, 01 Dec 1994 16:00:00 GMT
25
+ Cache-Control:
26
+ - max-age=0, no-cache, no-store
27
+ Bk-Server:
28
+ - 8ced
29
+ Content-Length:
30
+ - '83'
31
+ Content-Type:
32
+ - application/json
33
+ body:
34
+ encoding: UTF-8
35
+ string: |
36
+ {
37
+ "status": 200,
38
+ "msg": "ok",
39
+ "userid": "9BKOJXy999OyJaaD",
40
+ "categories": []
41
+ }
42
+ http_version:
43
+ recorded_at: Tue, 14 Apr 2015 11:33:03 GMT
44
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,56 @@
1
+ RSpec.describe Bluekai::Category, :vcr do
2
+ include_context 'signature_mock'
3
+
4
+ it 'reads a category and its reach' do
5
+ read_response = subject.category_read(category_id: 421262, stats: 'True')
6
+ expect(read_response).to include(
7
+ name: 'Action',
8
+ id: 421262,
9
+ description: 'People who converted for Action games',
10
+ leaf: true,
11
+ parent_id: 421229
12
+ )
13
+ expect(read_response[:rules].size).to be > 0
14
+ end
15
+
16
+ it 'lists 4 categories' do
17
+ list_response = subject.category_list(offset: 0, size: 4)
18
+ expect(list_response.count).to eq(4)
19
+ expect(list_response).to all(have_key(:name))
20
+ expect(list_response).to all(have_key(:rules))
21
+ end
22
+
23
+ it 'creates a category' do
24
+ category_body = {
25
+ name: 'Test Category 123',
26
+ parent_id: '424547',
27
+ description: 'an example category',
28
+ analytics_excluded: 'false',
29
+ navigation_only: 'false',
30
+ mutex_children: 'false',
31
+ notes: 'Just an API test'
32
+ }
33
+ create_response = subject.category_create(category_body)
34
+ expect(create_response).to include(
35
+ name: 'Test Category 123',
36
+ parent_id: 424547,
37
+ description: 'an example category',
38
+ analytics_excluded: false,
39
+ navigation_only: false,
40
+ mutex_children: false,
41
+ notes: 'Just an API test'
42
+ )
43
+ end
44
+
45
+ it 'updates a category' do
46
+ category_update_body = {
47
+ name: 'Test Category 321',
48
+ description: 'an example category wohooo'
49
+ }
50
+ update_response = subject.category_update(424547, category_update_body)
51
+ expect(update_response).to include(
52
+ name: 'Test Category 321',
53
+ description: 'an example category wohooo'
54
+ )
55
+ end
56
+ end
@@ -1,18 +1,5 @@
1
- require 'bluekai/client'
2
- require 'bluekai/error'
3
-
4
1
  RSpec.describe Bluekai::Client, :vcr do
5
- before :each do
6
- allow(subject).to receive(:sign).and_wrap_original do |method, http_method, path, query, body|
7
- string_to_sign = http_method + path + query.to_s + body.to_s
8
- hash = Digest::SHA256.hexdigest(string_to_sign)
9
- file = "spec/fixtures/signatures/#{hash}"
10
- next File.read(file) if File.exist?(file)
11
- result = method.call(http_method, path, query, body)
12
- File.open(file, 'w+') { |f| f.write(result) }
13
- result
14
- end
15
- end
2
+ include_context 'signature_mock'
16
3
 
17
4
  it 'performs a ping' do
18
5
  expect(subject.ping).to eq(true)
@@ -23,131 +10,4 @@ RSpec.describe Bluekai::Client, :vcr do
23
10
  expect(tax_response).to all(have_key(:nodeID))
24
11
  expect(tax_response).to all(have_key(:nodeName))
25
12
  end
26
-
27
- it 'creates a rule' do
28
- rule_body = {
29
- name: 'CONVERSION_TEST_123',
30
- type: 'phint',
31
- phints: [{
32
- key: 'offer_id',
33
- value: 321,
34
- operator: 'is'
35
- }],
36
- category_ids: [421262],
37
- site_ids: [23705]
38
- }
39
- create_response = subject.rule_create(rule_body)
40
- expect(create_response).to include(
41
- name: 'CONVERSION_TEST_123',
42
- type: 'phint',
43
- status: 'active',
44
- phints: [{ id: 16552, key: 'offer_id', value: '321', operator: 'is' }],
45
- categories: [{ id: 421262, name: 'Action' }],
46
- sites: [{ id: 23705, name: 'Cake - Data Collection Tag' }]
47
- )
48
- end
49
-
50
- it 'updates a rule' do
51
- update_body = {
52
- name: 'CONVERSION_TEST_321',
53
- type: 'phint',
54
- phints: [{
55
- key: 'offer_id',
56
- value: 321,
57
- operator: 'contains'
58
- }],
59
- category_ids: [421262],
60
- site_ids: [23705]
61
- }
62
-
63
- update_response = subject.rule_update(12490, update_body)
64
-
65
- expect(update_response).to include(
66
- name: 'CONVERSION_TEST_321',
67
- type: 'phint',
68
- status: 'active',
69
- phints: [{ id: 16543, key: 'offer_id', value: '321', operator: 'contains' }],
70
- categories: [{ id: 421262, name: 'Action' }]
71
- )
72
- end
73
-
74
- it 'reads a rule' do
75
- read_response = subject.rule_read(10380)
76
- expect(read_response).to include(
77
- categories: [{ id: 421427, name: 'Simulation' },
78
- { id: 421262, name: 'Action' }],
79
- created_at: 'Thu Apr 02 09:50:57 CDT 2015',
80
- id: 10380,
81
- name: 'CONVERSION_ACTION_SIMULATION_9126',
82
- phints: [{ id: 14420, key: 'offer_id', value: '9126', operator: 'is' }],
83
- sites: [{ id: 23705, name: 'Cake - Data Collection Tag' }],
84
- status: 'active',
85
- type: 'phint'
86
- )
87
- end
88
-
89
- it 'lists 10 phint rules' do
90
- rule_list = subject.rule_list(offset: 0, size: 10, type: 'phint')
91
- expect(rule_list.count).to eq(10)
92
- expect(rule_list).to all(include(
93
- type: 'phint'
94
- ))
95
- end
96
-
97
- ###
98
- # Categories
99
- ###
100
-
101
- it 'reads a category and its reach' do
102
- read_response = subject.category_read(category_id: 421262, stats: 'True')
103
- expect(read_response).to include(
104
- name: 'Action',
105
- id: 421262,
106
- description: 'People who converted for Action games',
107
- leaf: true,
108
- parent_id: 421229
109
- )
110
- expect(read_response[:rules].size).to be > 0
111
- end
112
-
113
- it 'lists 4 categories' do
114
- list_response = subject.category_list(offset: 0, size: 4)
115
- expect(list_response.count).to eq(4)
116
- expect(list_response).to all(have_key(:name))
117
- expect(list_response).to all(have_key(:rules))
118
- end
119
-
120
- it 'creates a category' do
121
- category_body = {
122
- name: 'Test Category 123',
123
- parent_id: '422741',
124
- description: 'an example category',
125
- analytics_excluded: 'false',
126
- navigation_only: 'false',
127
- mutex_children: 'false',
128
- notes: 'Just an API test'
129
- }
130
- create_response = subject.category_create(category_body)
131
- expect(create_response).to include(
132
- name: 'Test Category 123',
133
- parent_id: 422741,
134
- description: 'an example category',
135
- analytics_excluded: false,
136
- navigation_only: false,
137
- mutex_children: false,
138
- notes: 'Just an API test'
139
- )
140
- end
141
-
142
- it 'updates a category' do
143
- category_update_body = {
144
- name: 'Test Category 321',
145
- description: 'an example category wohooo'
146
- }
147
- update_response = subject.category_update(424251, category_update_body)
148
- expect(update_response).to include(
149
- name: 'Test Category 321',
150
- description: 'an example category wohooo'
151
- )
152
- end
153
13
  end
@@ -1,6 +1,3 @@
1
- require 'bluekai/client'
2
- require 'bluekai/error'
3
-
4
1
  RSpec.describe Bluekai::Client do
5
2
  subject { described_class.new(api_private_key: '1234') }
6
3