vhx-ruby 0.0.7 → 0.0.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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -1
  3. data/lib/vhx.rb +4 -3
  4. data/lib/vhx/client.rb +6 -3
  5. data/lib/vhx/objects/analytics.rb +9 -0
  6. data/lib/vhx/utilities/vhx_object.rb +2 -2
  7. data/lib/vhx/version.rb +2 -2
  8. data/spec/client_spec.rb +44 -9
  9. data/spec/fixtures/sample_authorization_response.json +19 -0
  10. data/spec/fixtures/sample_collection_response.json +20 -0
  11. data/spec/fixtures/sample_collections_response.json +14 -0
  12. data/spec/fixtures/sample_create_video_response.json +33 -0
  13. data/spec/fixtures/sample_customer_response.json +16 -0
  14. data/spec/fixtures/sample_customers_response.json +28 -0
  15. data/spec/fixtures/sample_files_response.json +16 -0
  16. data/spec/fixtures/sample_product_response.json +30 -0
  17. data/spec/fixtures/sample_products_response.json +14 -0
  18. data/spec/fixtures/sample_video_response.json +47 -31
  19. data/spec/fixtures/sample_videos_response.json +14 -0
  20. data/spec/middleware/error_response_spec.rb +3 -7
  21. data/spec/middleware/oauth2_spec.rb +3 -7
  22. data/spec/objects/analytics_spec.rb +41 -0
  23. data/spec/objects/authorization_spec.rb +58 -0
  24. data/spec/objects/collection_item_spec.rb +53 -0
  25. data/spec/objects/collection_spec.rb +66 -0
  26. data/spec/objects/customer_spec.rb +82 -0
  27. data/spec/objects/product_spec.rb +65 -0
  28. data/spec/objects/site_spec.rb +36 -27
  29. data/spec/objects/user_spec.rb +40 -32
  30. data/spec/objects/video_file_spec.rb +52 -0
  31. data/spec/objects/video_spec.rb +67 -23
  32. data/spec/spec_helper.rb +2 -11
  33. data/spec/utilities/vhx_helper_spec.rb +11 -7
  34. data/spec/utilities/vhx_list_object_spec.rb +27 -0
  35. data/spec/utilities/vhx_object_spec.rb +69 -26
  36. data/vhx.gemspec +4 -4
  37. metadata +59 -66
  38. data/spec/fixtures/sample_package_response.json +0 -185
  39. data/spec/objects/file_spec.rb +0 -29
  40. data/spec/objects/package_spec.rb +0 -74
  41. data/spec/test_data.rb +0 -55
  42. data/spec/utilities/vhx_collection_spec.rb +0 -27
  43. data/spec/vcr/Vhx_Client/application_user/_refresh_access_token/access_token_changed.yml +0 -57
  44. data/spec/vcr/Vhx_Client/application_user/_refresh_access_token/oauth_token_refreshed.yml +0 -57
  45. data/spec/vcr/Vhx_File/associations/are_present.yml +0 -409
  46. data/spec/vcr/Vhx_Middleware_ErrorResponse/unauthorized_user_credentials.yml +0 -122
  47. data/spec/vcr/Vhx_Middleware_OAuth2/access_token_refresh.yml +0 -797
  48. data/spec/vcr/Vhx_Package/_add_video/with_hypermedia/returns_package_object.yml +0 -51
  49. data/spec/vcr/Vhx_Package/_add_video/with_id/returns_package_object.yml +0 -51
  50. data/spec/vcr/Vhx_Package/_create/returns_package_object.yml +0 -140
  51. data/spec/vcr/Vhx_Package/_find/with_hypermedia.yml +0 -243
  52. data/spec/vcr/Vhx_Package/_find/with_id.yml +0 -243
  53. data/spec/vcr/Vhx_Package/_remove_video/with_hypermedia/returns_success.yml +0 -51
  54. data/spec/vcr/Vhx_Package/_remove_video/with_id/returns_success.yml +0 -51
  55. data/spec/vcr/Vhx_Package/associations/are_present.yml +0 -195
  56. data/spec/vcr/Vhx_Site/_create/returns_site_object.yml +0 -91
  57. data/spec/vcr/Vhx_Site/_find/with_hypermedia.yml +0 -195
  58. data/spec/vcr/Vhx_Site/_find/with_id.yml +0 -195
  59. data/spec/vcr/Vhx_User/_find/with_hypermedia.yml +0 -81
  60. data/spec/vcr/Vhx_User/_find/with_id.yml +0 -81
  61. data/spec/vcr/Vhx_User/_me/returns_user_object.yml +0 -720
  62. data/spec/vcr/Vhx_User/_update/returns_user_object.yml +0 -212
  63. data/spec/vcr/Vhx_VhxObject/associations/cache/retreive_if_available.yml +0 -195
  64. data/spec/vcr/Vhx_VhxObject/associations/falls_back_to_links.yml +0 -310
  65. data/spec/vcr/Vhx_Video/_create/returns_video_object.yml +0 -125
  66. data/spec/vcr/Vhx_Video/associations/are_present.yml +0 -294
@@ -1,91 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://api.crystal.dev/sites
6
- body:
7
- encoding: UTF-8
8
- string: description=For+testing+gem&title=Gem+New+Site
9
- headers:
10
- Authorization:
11
- - Bearer 41d2ed8ead125347d38cf13dd7da8df0a32e9c9e839a9ea1b39c0d4f8b9caa92
12
- User-Agent:
13
- - Faraday v0.9.1
14
- Content-Type:
15
- - application/x-www-form-urlencoded
16
- Accept-Encoding:
17
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
- Accept:
19
- - "*/*"
20
- response:
21
- status:
22
- code: 201
23
- message: Created
24
- headers:
25
- Date:
26
- - Mon, 04 May 2015 19:42:35 GMT
27
- Status:
28
- - 201 Created
29
- Connection:
30
- - close
31
- Cache-Control:
32
- - private, no-cache, max-age=0, must-revalidate
33
- Surrogate-Control:
34
- - no-cache
35
- Content-Type:
36
- - application/json; charset=utf-8
37
- Vary:
38
- - Accept-Encoding
39
- X-Ua-Compatible:
40
- - IE=Edge
41
- Set-Cookie:
42
- - _session=BAh7CEkiD3Nlc3Npb25faWQGOgZFVEkiJWM5NDg5YWIyNWM3MjZkNTk2MTMxNjJhYjU4YzIxZDQ2BjsAVEkiGGN1cnJlbnRfYXBwbGljYXRpb24GOwBGSSIKc2FnYXIGOwBUSSIRY3VycmVudF91c2VyBjsARkkiEXNhZ2FyQHZoeC50dgY7AFQ%3D--450649d96553800bb2754a3186bb6ef10b931c2a;
43
- domain=.crystal.dev; path=/; expires=Wed, 04-May-2016 19:42:35 GMT; HttpOnly
44
- X-Meta-Request-Version:
45
- - 0.3.4
46
- X-Request-Id:
47
- - c1a4ad6581fce77a5a48ddcca939ca19
48
- X-Runtime:
49
- - '0.633497'
50
- Transfer-Encoding:
51
- - chunked
52
- body:
53
- encoding: UTF-8
54
- string: |
55
- {
56
- "_links": {
57
- "self": {
58
- "href": "http://api.crystal.dev/sites/11439"
59
- },
60
- "home_page": {
61
- "href": "http://gemnewsite.crystal.dev"
62
- },
63
- "followers": {
64
- "href": "http://api.crystal.dev/sites/11439/followers"
65
- }
66
- },
67
- "_embedded": {
68
- "subscription": null,
69
- "packages": [
70
-
71
- ]
72
- },
73
- "id": 11439,
74
- "title": "Gem New Site",
75
- "description": "For testing gem",
76
- "domain": "gemnewsite.crystal.dev",
77
- "subdomain": "gemnewsite",
78
- "key": "gemnewsite",
79
- "color": "#22B9B0",
80
- "facebook_url": null,
81
- "twitter_name": null,
82
- "google_analytics_id": null,
83
- "packages_count": 0,
84
- "videos_count": 0,
85
- "followers_count": 0,
86
- "created_at": "2015-05-04T19:42:34Z",
87
- "updated_at": "2015-05-04T19:42:34Z"
88
- }
89
- http_version:
90
- recorded_at: Mon, 04 May 2015 19:42:35 GMT
91
- recorded_with: VCR 2.9.3
@@ -1,195 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://api.crystal.dev/sites/1900
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Authorization:
11
- - Bearer 41d2ed8ead125347d38cf13dd7da8df0a32e9c9e839a9ea1b39c0d4f8b9caa92
12
- User-Agent:
13
- - Faraday v0.9.1
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - "*/*"
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Date:
24
- - Mon, 04 May 2015 19:41:17 GMT
25
- Status:
26
- - 200 OK
27
- Connection:
28
- - close
29
- Cache-Control:
30
- - public, no-cache, must-revalidate
31
- Surrogate-Control:
32
- - max-age=3600
33
- Surrogate-Key:
34
- - sites/1900
35
- Etag:
36
- - '"a4c59eb7508fb0ebf5f7d71af2ab6e57"'
37
- Last-Modified:
38
- - Mon, 04 May 2015 19:37:32 GMT
39
- Content-Type:
40
- - application/json; charset=utf-8
41
- Vary:
42
- - Accept-Encoding
43
- X-Ua-Compatible:
44
- - IE=Edge
45
- X-Meta-Request-Version:
46
- - 0.3.4
47
- X-Request-Id:
48
- - 23ecc8b8ded977c0398c1677433163f1
49
- X-Runtime:
50
- - '0.146038'
51
- Transfer-Encoding:
52
- - chunked
53
- body:
54
- encoding: UTF-8
55
- string: |
56
- {
57
- "_links": {
58
- "self": {
59
- "href": "http://api.crystal.dev/sites/1900"
60
- },
61
- "home_page": {
62
- "href": "http://sagartestmovie.crystal.dev"
63
- },
64
- "followers": {
65
- "href": "http://api.crystal.dev/sites/1900/followers"
66
- }
67
- },
68
- "_embedded": {
69
- "subscription": null,
70
- "packages": [
71
- {
72
- "_links": {
73
- "self": {
74
- "href": "http://api.crystal.dev/packages/2780"
75
- },
76
- "site": {
77
- "href": "http://api.crystal.dev/sites/1900"
78
- },
79
- "videos": {
80
- "href": "http://api.crystal.dev/packages/2780/videos"
81
- },
82
- "buy_page": {
83
- "href": "http://sagartestmovie.crystal.dev/buy/pwyw-1"
84
- },
85
- "home_page": {
86
- "href": "http://sagartestmovie.crystal.dev/packages/pwyw-1"
87
- }
88
- },
89
- "_embedded": {
90
- "trailer": null
91
- },
92
- "id": 2780,
93
- "title": "pwyw",
94
- "description": "",
95
- "sku": "pwyw-1",
96
- "price": {
97
- "cents": 500,
98
- "currency": "USD",
99
- "formatted": "$5",
100
- "US": {
101
- "cents": 500,
102
- "currency": "USD",
103
- "formatted": "$5"
104
- }
105
- },
106
- "rental": null,
107
- "trailer_url": null,
108
- "trailer_embed_code": "<iframe src=\"http://embed.crystal.dev/packages/2780\" width=\"640\" height=\"360\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>",
109
- "thumbnail": {
110
- "small": "http://cdn.crystal.dev/assets/thumbnails/default-small.png",
111
- "medium": "http://cdn.crystal.dev/assets/thumbnails/default-medium.png",
112
- "large": "http://cdn.crystal.dev/assets/thumbnails/default-large.png",
113
- "blurred": null
114
- },
115
- "is_active": true,
116
- "is_preorder": false,
117
- "release_date": null,
118
- "videos_count": 0,
119
- "extras_count": 0,
120
- "created_at": "2014-07-15T18:15:36Z",
121
- "updated_at": "2014-08-26T14:48:52Z"
122
- },
123
- {
124
- "_links": {
125
- "self": {
126
- "href": "http://api.crystal.dev/packages/7381"
127
- },
128
- "site": {
129
- "href": "http://api.crystal.dev/sites/1900"
130
- },
131
- "videos": {
132
- "href": "http://api.crystal.dev/packages/7381/videos"
133
- },
134
- "buy_page": {
135
- "href": "http://sagartestmovie.crystal.dev/buy/test-package-2"
136
- },
137
- "home_page": {
138
- "href": "http://sagartestmovie.crystal.dev/packages/test-package-2"
139
- }
140
- },
141
- "_embedded": {
142
- "trailer": null
143
- },
144
- "id": 7381,
145
- "title": "test package",
146
- "description": "test description",
147
- "sku": "test-package-2",
148
- "price": {
149
- "cents": 1000,
150
- "currency": "USD",
151
- "formatted": "$10",
152
- "US": {
153
- "cents": 1000,
154
- "currency": "USD",
155
- "formatted": "$10"
156
- }
157
- },
158
- "rental": null,
159
- "trailer_url": null,
160
- "trailer_embed_code": "<iframe src=\"http://embed.crystal.dev/packages/7381\" width=\"640\" height=\"360\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>",
161
- "thumbnail": {
162
- "small": "http://cdn.crystal.dev/assets/thumbnails/default-small.png",
163
- "medium": "http://cdn.crystal.dev/assets/thumbnails/default-medium.png",
164
- "large": "http://cdn.crystal.dev/assets/thumbnails/default-large.png",
165
- "blurred": null
166
- },
167
- "is_active": true,
168
- "is_preorder": false,
169
- "release_date": null,
170
- "videos_count": 0,
171
- "extras_count": 0,
172
- "created_at": "2015-05-04T19:15:09Z",
173
- "updated_at": "2015-05-04T19:15:09Z"
174
- }
175
- ]
176
- },
177
- "id": 1900,
178
- "title": "SagarTestMovie",
179
- "description": "This is my test movie. ",
180
- "domain": "sagartestmovie.crystal.dev",
181
- "subdomain": "sagartestmovie",
182
- "key": "sagartestmovie",
183
- "color": "#28DBF7",
184
- "facebook_url": null,
185
- "twitter_name": null,
186
- "google_analytics_id": "",
187
- "packages_count": 2,
188
- "videos_count": 3,
189
- "followers_count": 30,
190
- "created_at": "2013-12-27T00:20:28Z",
191
- "updated_at": "2015-05-04T19:37:32Z"
192
- }
193
- http_version:
194
- recorded_at: Mon, 04 May 2015 19:41:17 GMT
195
- recorded_with: VCR 2.9.3
@@ -1,195 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://api.crystal.dev/sites/1900
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Authorization:
11
- - Bearer 41d2ed8ead125347d38cf13dd7da8df0a32e9c9e839a9ea1b39c0d4f8b9caa92
12
- User-Agent:
13
- - Faraday v0.9.1
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - "*/*"
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Date:
24
- - Mon, 04 May 2015 19:41:17 GMT
25
- Status:
26
- - 200 OK
27
- Connection:
28
- - close
29
- Cache-Control:
30
- - public, no-cache, must-revalidate
31
- Surrogate-Control:
32
- - max-age=3600
33
- Surrogate-Key:
34
- - sites/1900
35
- Etag:
36
- - '"a4c59eb7508fb0ebf5f7d71af2ab6e57"'
37
- Last-Modified:
38
- - Mon, 04 May 2015 19:37:32 GMT
39
- Content-Type:
40
- - application/json; charset=utf-8
41
- Vary:
42
- - Accept-Encoding
43
- X-Ua-Compatible:
44
- - IE=Edge
45
- X-Meta-Request-Version:
46
- - 0.3.4
47
- X-Request-Id:
48
- - 0ac5270abdd8b424c912bf46a39aaf12
49
- X-Runtime:
50
- - '0.137099'
51
- Transfer-Encoding:
52
- - chunked
53
- body:
54
- encoding: UTF-8
55
- string: |
56
- {
57
- "_links": {
58
- "self": {
59
- "href": "http://api.crystal.dev/sites/1900"
60
- },
61
- "home_page": {
62
- "href": "http://sagartestmovie.crystal.dev"
63
- },
64
- "followers": {
65
- "href": "http://api.crystal.dev/sites/1900/followers"
66
- }
67
- },
68
- "_embedded": {
69
- "subscription": null,
70
- "packages": [
71
- {
72
- "_links": {
73
- "self": {
74
- "href": "http://api.crystal.dev/packages/2780"
75
- },
76
- "site": {
77
- "href": "http://api.crystal.dev/sites/1900"
78
- },
79
- "videos": {
80
- "href": "http://api.crystal.dev/packages/2780/videos"
81
- },
82
- "buy_page": {
83
- "href": "http://sagartestmovie.crystal.dev/buy/pwyw-1"
84
- },
85
- "home_page": {
86
- "href": "http://sagartestmovie.crystal.dev/packages/pwyw-1"
87
- }
88
- },
89
- "_embedded": {
90
- "trailer": null
91
- },
92
- "id": 2780,
93
- "title": "pwyw",
94
- "description": "",
95
- "sku": "pwyw-1",
96
- "price": {
97
- "cents": 500,
98
- "currency": "USD",
99
- "formatted": "$5",
100
- "US": {
101
- "cents": 500,
102
- "currency": "USD",
103
- "formatted": "$5"
104
- }
105
- },
106
- "rental": null,
107
- "trailer_url": null,
108
- "trailer_embed_code": "<iframe src=\"http://embed.crystal.dev/packages/2780\" width=\"640\" height=\"360\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>",
109
- "thumbnail": {
110
- "small": "http://cdn.crystal.dev/assets/thumbnails/default-small.png",
111
- "medium": "http://cdn.crystal.dev/assets/thumbnails/default-medium.png",
112
- "large": "http://cdn.crystal.dev/assets/thumbnails/default-large.png",
113
- "blurred": null
114
- },
115
- "is_active": true,
116
- "is_preorder": false,
117
- "release_date": null,
118
- "videos_count": 0,
119
- "extras_count": 0,
120
- "created_at": "2014-07-15T18:15:36Z",
121
- "updated_at": "2014-08-26T14:48:52Z"
122
- },
123
- {
124
- "_links": {
125
- "self": {
126
- "href": "http://api.crystal.dev/packages/7381"
127
- },
128
- "site": {
129
- "href": "http://api.crystal.dev/sites/1900"
130
- },
131
- "videos": {
132
- "href": "http://api.crystal.dev/packages/7381/videos"
133
- },
134
- "buy_page": {
135
- "href": "http://sagartestmovie.crystal.dev/buy/test-package-2"
136
- },
137
- "home_page": {
138
- "href": "http://sagartestmovie.crystal.dev/packages/test-package-2"
139
- }
140
- },
141
- "_embedded": {
142
- "trailer": null
143
- },
144
- "id": 7381,
145
- "title": "test package",
146
- "description": "test description",
147
- "sku": "test-package-2",
148
- "price": {
149
- "cents": 1000,
150
- "currency": "USD",
151
- "formatted": "$10",
152
- "US": {
153
- "cents": 1000,
154
- "currency": "USD",
155
- "formatted": "$10"
156
- }
157
- },
158
- "rental": null,
159
- "trailer_url": null,
160
- "trailer_embed_code": "<iframe src=\"http://embed.crystal.dev/packages/7381\" width=\"640\" height=\"360\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>",
161
- "thumbnail": {
162
- "small": "http://cdn.crystal.dev/assets/thumbnails/default-small.png",
163
- "medium": "http://cdn.crystal.dev/assets/thumbnails/default-medium.png",
164
- "large": "http://cdn.crystal.dev/assets/thumbnails/default-large.png",
165
- "blurred": null
166
- },
167
- "is_active": true,
168
- "is_preorder": false,
169
- "release_date": null,
170
- "videos_count": 0,
171
- "extras_count": 0,
172
- "created_at": "2015-05-04T19:15:09Z",
173
- "updated_at": "2015-05-04T19:15:09Z"
174
- }
175
- ]
176
- },
177
- "id": 1900,
178
- "title": "SagarTestMovie",
179
- "description": "This is my test movie. ",
180
- "domain": "sagartestmovie.crystal.dev",
181
- "subdomain": "sagartestmovie",
182
- "key": "sagartestmovie",
183
- "color": "#28DBF7",
184
- "facebook_url": null,
185
- "twitter_name": null,
186
- "google_analytics_id": "",
187
- "packages_count": 2,
188
- "videos_count": 3,
189
- "followers_count": 30,
190
- "created_at": "2013-12-27T00:20:28Z",
191
- "updated_at": "2015-05-04T19:37:32Z"
192
- }
193
- http_version:
194
- recorded_at: Mon, 04 May 2015 19:41:17 GMT
195
- recorded_with: VCR 2.9.3