vhx-ruby 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/vhx.rb +4 -3
- data/lib/vhx/client.rb +6 -3
- data/lib/vhx/objects/analytics.rb +9 -0
- data/lib/vhx/utilities/vhx_object.rb +2 -2
- data/lib/vhx/version.rb +2 -2
- data/spec/client_spec.rb +44 -9
- data/spec/fixtures/sample_authorization_response.json +19 -0
- data/spec/fixtures/sample_collection_response.json +20 -0
- data/spec/fixtures/sample_collections_response.json +14 -0
- data/spec/fixtures/sample_create_video_response.json +33 -0
- data/spec/fixtures/sample_customer_response.json +16 -0
- data/spec/fixtures/sample_customers_response.json +28 -0
- data/spec/fixtures/sample_files_response.json +16 -0
- data/spec/fixtures/sample_product_response.json +30 -0
- data/spec/fixtures/sample_products_response.json +14 -0
- data/spec/fixtures/sample_video_response.json +47 -31
- data/spec/fixtures/sample_videos_response.json +14 -0
- data/spec/middleware/error_response_spec.rb +3 -7
- data/spec/middleware/oauth2_spec.rb +3 -7
- data/spec/objects/analytics_spec.rb +41 -0
- data/spec/objects/authorization_spec.rb +58 -0
- data/spec/objects/collection_item_spec.rb +53 -0
- data/spec/objects/collection_spec.rb +66 -0
- data/spec/objects/customer_spec.rb +82 -0
- data/spec/objects/product_spec.rb +65 -0
- data/spec/objects/site_spec.rb +36 -27
- data/spec/objects/user_spec.rb +40 -32
- data/spec/objects/video_file_spec.rb +52 -0
- data/spec/objects/video_spec.rb +67 -23
- data/spec/spec_helper.rb +2 -11
- data/spec/utilities/vhx_helper_spec.rb +11 -7
- data/spec/utilities/vhx_list_object_spec.rb +27 -0
- data/spec/utilities/vhx_object_spec.rb +69 -26
- data/vhx.gemspec +4 -4
- metadata +59 -66
- data/spec/fixtures/sample_package_response.json +0 -185
- data/spec/objects/file_spec.rb +0 -29
- data/spec/objects/package_spec.rb +0 -74
- data/spec/test_data.rb +0 -55
- data/spec/utilities/vhx_collection_spec.rb +0 -27
- data/spec/vcr/Vhx_Client/application_user/_refresh_access_token/access_token_changed.yml +0 -57
- data/spec/vcr/Vhx_Client/application_user/_refresh_access_token/oauth_token_refreshed.yml +0 -57
- data/spec/vcr/Vhx_File/associations/are_present.yml +0 -409
- data/spec/vcr/Vhx_Middleware_ErrorResponse/unauthorized_user_credentials.yml +0 -122
- data/spec/vcr/Vhx_Middleware_OAuth2/access_token_refresh.yml +0 -797
- data/spec/vcr/Vhx_Package/_add_video/with_hypermedia/returns_package_object.yml +0 -51
- data/spec/vcr/Vhx_Package/_add_video/with_id/returns_package_object.yml +0 -51
- data/spec/vcr/Vhx_Package/_create/returns_package_object.yml +0 -140
- data/spec/vcr/Vhx_Package/_find/with_hypermedia.yml +0 -243
- data/spec/vcr/Vhx_Package/_find/with_id.yml +0 -243
- data/spec/vcr/Vhx_Package/_remove_video/with_hypermedia/returns_success.yml +0 -51
- data/spec/vcr/Vhx_Package/_remove_video/with_id/returns_success.yml +0 -51
- data/spec/vcr/Vhx_Package/associations/are_present.yml +0 -195
- data/spec/vcr/Vhx_Site/_create/returns_site_object.yml +0 -91
- data/spec/vcr/Vhx_Site/_find/with_hypermedia.yml +0 -195
- data/spec/vcr/Vhx_Site/_find/with_id.yml +0 -195
- data/spec/vcr/Vhx_User/_find/with_hypermedia.yml +0 -81
- data/spec/vcr/Vhx_User/_find/with_id.yml +0 -81
- data/spec/vcr/Vhx_User/_me/returns_user_object.yml +0 -720
- data/spec/vcr/Vhx_User/_update/returns_user_object.yml +0 -212
- data/spec/vcr/Vhx_VhxObject/associations/cache/retreive_if_available.yml +0 -195
- data/spec/vcr/Vhx_VhxObject/associations/falls_back_to_links.yml +0 -310
- data/spec/vcr/Vhx_Video/_create/returns_video_object.yml +0 -125
- data/spec/vcr/Vhx_Video/associations/are_present.yml +0 -294
data/vhx.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = 'vhx-ruby'
|
7
7
|
spec.version = Vhx::VERSION
|
8
8
|
spec.authors = ['Sagar Shah']
|
9
|
-
spec.date = '
|
9
|
+
spec.date = '2017-01-06'
|
10
10
|
spec.description = 'A Ruby wrapper for the Vhx developer API.'
|
11
11
|
spec.summary = 'A Ruby wrapper for the Vhx developer API.'
|
12
12
|
spec.email = ['sagar@vhx.tv', 'dev@vhx.tv', 'wontae@vhx.tv', 'charlie@vhx.tv', 'kevin@vhx.tv', 'scott@vhx.tv']
|
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency 'faraday', '~> 0.9.1'
|
23
23
|
spec.add_dependency 'faraday_middleware', '~> 0.9.1'
|
24
24
|
|
25
|
-
spec.
|
26
|
-
|
27
|
-
end
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'webmock'
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vhx-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sagar Shah
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -39,19 +39,33 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.9.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
type: :
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: '0'
|
55
69
|
description: A Ruby wrapper for the Vhx developer API.
|
56
70
|
email:
|
57
71
|
- sagar@vhx.tv
|
@@ -75,6 +89,7 @@ files:
|
|
75
89
|
- lib/vhx/middleware/error_response.rb
|
76
90
|
- lib/vhx/middleware/oauth2.rb
|
77
91
|
- lib/vhx/oauth_token.rb
|
92
|
+
- lib/vhx/objects/analytics.rb
|
78
93
|
- lib/vhx/objects/authorization.rb
|
79
94
|
- lib/vhx/objects/collection.rb
|
80
95
|
- lib/vhx/objects/collection_item.rb
|
@@ -95,48 +110,37 @@ files:
|
|
95
110
|
- lib/vhx/version.rb
|
96
111
|
- spec/client_spec.rb
|
97
112
|
- spec/fixtures/sample_array_list.json
|
113
|
+
- spec/fixtures/sample_authorization_response.json
|
114
|
+
- spec/fixtures/sample_collection_response.json
|
115
|
+
- spec/fixtures/sample_collections_response.json
|
116
|
+
- spec/fixtures/sample_create_video_response.json
|
117
|
+
- spec/fixtures/sample_customer_response.json
|
118
|
+
- spec/fixtures/sample_customers_response.json
|
98
119
|
- spec/fixtures/sample_file_response.json
|
120
|
+
- spec/fixtures/sample_files_response.json
|
99
121
|
- spec/fixtures/sample_hash_list.json
|
100
|
-
- spec/fixtures/
|
122
|
+
- spec/fixtures/sample_product_response.json
|
123
|
+
- spec/fixtures/sample_products_response.json
|
101
124
|
- spec/fixtures/sample_site_response.json
|
102
125
|
- spec/fixtures/sample_user_response.json
|
103
126
|
- spec/fixtures/sample_video_response.json
|
127
|
+
- spec/fixtures/sample_videos_response.json
|
104
128
|
- spec/middleware/error_response_spec.rb
|
105
129
|
- spec/middleware/oauth2_spec.rb
|
106
|
-
- spec/objects/
|
107
|
-
- spec/objects/
|
130
|
+
- spec/objects/analytics_spec.rb
|
131
|
+
- spec/objects/authorization_spec.rb
|
132
|
+
- spec/objects/collection_item_spec.rb
|
133
|
+
- spec/objects/collection_spec.rb
|
134
|
+
- spec/objects/customer_spec.rb
|
135
|
+
- spec/objects/product_spec.rb
|
108
136
|
- spec/objects/site_spec.rb
|
109
137
|
- spec/objects/user_spec.rb
|
138
|
+
- spec/objects/video_file_spec.rb
|
110
139
|
- spec/objects/video_spec.rb
|
111
140
|
- spec/spec_helper.rb
|
112
|
-
- spec/test_data.rb
|
113
|
-
- spec/utilities/vhx_collection_spec.rb
|
114
141
|
- spec/utilities/vhx_helper_spec.rb
|
142
|
+
- spec/utilities/vhx_list_object_spec.rb
|
115
143
|
- spec/utilities/vhx_object_spec.rb
|
116
|
-
- spec/vcr/Vhx_Client/application_user/_refresh_access_token/access_token_changed.yml
|
117
|
-
- spec/vcr/Vhx_Client/application_user/_refresh_access_token/oauth_token_refreshed.yml
|
118
|
-
- spec/vcr/Vhx_File/associations/are_present.yml
|
119
|
-
- spec/vcr/Vhx_Middleware_ErrorResponse/unauthorized_user_credentials.yml
|
120
|
-
- spec/vcr/Vhx_Middleware_OAuth2/access_token_refresh.yml
|
121
|
-
- spec/vcr/Vhx_Package/_add_video/with_hypermedia/returns_package_object.yml
|
122
|
-
- spec/vcr/Vhx_Package/_add_video/with_id/returns_package_object.yml
|
123
|
-
- spec/vcr/Vhx_Package/_create/returns_package_object.yml
|
124
|
-
- spec/vcr/Vhx_Package/_find/with_hypermedia.yml
|
125
|
-
- spec/vcr/Vhx_Package/_find/with_id.yml
|
126
|
-
- spec/vcr/Vhx_Package/_remove_video/with_hypermedia/returns_success.yml
|
127
|
-
- spec/vcr/Vhx_Package/_remove_video/with_id/returns_success.yml
|
128
|
-
- spec/vcr/Vhx_Package/associations/are_present.yml
|
129
|
-
- spec/vcr/Vhx_Site/_create/returns_site_object.yml
|
130
|
-
- spec/vcr/Vhx_Site/_find/with_hypermedia.yml
|
131
|
-
- spec/vcr/Vhx_Site/_find/with_id.yml
|
132
|
-
- spec/vcr/Vhx_User/_find/with_hypermedia.yml
|
133
|
-
- spec/vcr/Vhx_User/_find/with_id.yml
|
134
|
-
- spec/vcr/Vhx_User/_me/returns_user_object.yml
|
135
|
-
- spec/vcr/Vhx_User/_update/returns_user_object.yml
|
136
|
-
- spec/vcr/Vhx_VhxObject/associations/cache/retreive_if_available.yml
|
137
|
-
- spec/vcr/Vhx_VhxObject/associations/falls_back_to_links.yml
|
138
|
-
- spec/vcr/Vhx_Video/_create/returns_video_object.yml
|
139
|
-
- spec/vcr/Vhx_Video/associations/are_present.yml
|
140
144
|
- vhx.gemspec
|
141
145
|
homepage: http://dev.vhx.tv/docs/api/
|
142
146
|
licenses:
|
@@ -165,45 +169,34 @@ summary: A Ruby wrapper for the Vhx developer API.
|
|
165
169
|
test_files:
|
166
170
|
- spec/client_spec.rb
|
167
171
|
- spec/fixtures/sample_array_list.json
|
172
|
+
- spec/fixtures/sample_authorization_response.json
|
173
|
+
- spec/fixtures/sample_collection_response.json
|
174
|
+
- spec/fixtures/sample_collections_response.json
|
175
|
+
- spec/fixtures/sample_create_video_response.json
|
176
|
+
- spec/fixtures/sample_customer_response.json
|
177
|
+
- spec/fixtures/sample_customers_response.json
|
168
178
|
- spec/fixtures/sample_file_response.json
|
179
|
+
- spec/fixtures/sample_files_response.json
|
169
180
|
- spec/fixtures/sample_hash_list.json
|
170
|
-
- spec/fixtures/
|
181
|
+
- spec/fixtures/sample_product_response.json
|
182
|
+
- spec/fixtures/sample_products_response.json
|
171
183
|
- spec/fixtures/sample_site_response.json
|
172
184
|
- spec/fixtures/sample_user_response.json
|
173
185
|
- spec/fixtures/sample_video_response.json
|
186
|
+
- spec/fixtures/sample_videos_response.json
|
174
187
|
- spec/middleware/error_response_spec.rb
|
175
188
|
- spec/middleware/oauth2_spec.rb
|
176
|
-
- spec/objects/
|
177
|
-
- spec/objects/
|
189
|
+
- spec/objects/analytics_spec.rb
|
190
|
+
- spec/objects/authorization_spec.rb
|
191
|
+
- spec/objects/collection_item_spec.rb
|
192
|
+
- spec/objects/collection_spec.rb
|
193
|
+
- spec/objects/customer_spec.rb
|
194
|
+
- spec/objects/product_spec.rb
|
178
195
|
- spec/objects/site_spec.rb
|
179
196
|
- spec/objects/user_spec.rb
|
197
|
+
- spec/objects/video_file_spec.rb
|
180
198
|
- spec/objects/video_spec.rb
|
181
199
|
- spec/spec_helper.rb
|
182
|
-
- spec/test_data.rb
|
183
|
-
- spec/utilities/vhx_collection_spec.rb
|
184
200
|
- spec/utilities/vhx_helper_spec.rb
|
201
|
+
- spec/utilities/vhx_list_object_spec.rb
|
185
202
|
- spec/utilities/vhx_object_spec.rb
|
186
|
-
- spec/vcr/Vhx_Client/application_user/_refresh_access_token/access_token_changed.yml
|
187
|
-
- spec/vcr/Vhx_Client/application_user/_refresh_access_token/oauth_token_refreshed.yml
|
188
|
-
- spec/vcr/Vhx_File/associations/are_present.yml
|
189
|
-
- spec/vcr/Vhx_Middleware_ErrorResponse/unauthorized_user_credentials.yml
|
190
|
-
- spec/vcr/Vhx_Middleware_OAuth2/access_token_refresh.yml
|
191
|
-
- spec/vcr/Vhx_Package/_add_video/with_hypermedia/returns_package_object.yml
|
192
|
-
- spec/vcr/Vhx_Package/_add_video/with_id/returns_package_object.yml
|
193
|
-
- spec/vcr/Vhx_Package/_create/returns_package_object.yml
|
194
|
-
- spec/vcr/Vhx_Package/_find/with_hypermedia.yml
|
195
|
-
- spec/vcr/Vhx_Package/_find/with_id.yml
|
196
|
-
- spec/vcr/Vhx_Package/_remove_video/with_hypermedia/returns_success.yml
|
197
|
-
- spec/vcr/Vhx_Package/_remove_video/with_id/returns_success.yml
|
198
|
-
- spec/vcr/Vhx_Package/associations/are_present.yml
|
199
|
-
- spec/vcr/Vhx_Site/_create/returns_site_object.yml
|
200
|
-
- spec/vcr/Vhx_Site/_find/with_hypermedia.yml
|
201
|
-
- spec/vcr/Vhx_Site/_find/with_id.yml
|
202
|
-
- spec/vcr/Vhx_User/_find/with_hypermedia.yml
|
203
|
-
- spec/vcr/Vhx_User/_find/with_id.yml
|
204
|
-
- spec/vcr/Vhx_User/_me/returns_user_object.yml
|
205
|
-
- spec/vcr/Vhx_User/_update/returns_user_object.yml
|
206
|
-
- spec/vcr/Vhx_VhxObject/associations/cache/retreive_if_available.yml
|
207
|
-
- spec/vcr/Vhx_VhxObject/associations/falls_back_to_links.yml
|
208
|
-
- spec/vcr/Vhx_Video/_create/returns_video_object.yml
|
209
|
-
- spec/vcr/Vhx_Video/associations/are_present.yml
|
@@ -1,185 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_links": {
|
3
|
-
"self": {
|
4
|
-
"href": "http://api.crystal.dev/packages/1025"
|
5
|
-
},
|
6
|
-
"site": {
|
7
|
-
"href": "http://api.crystal.dev/sites/1900"
|
8
|
-
},
|
9
|
-
"videos": {
|
10
|
-
"href": "http://api.crystal.dev/packages/1025/videos"
|
11
|
-
},
|
12
|
-
"buy_page": {
|
13
|
-
"href": "http://sagartestmovie.crystal.dev/buy/testing123"
|
14
|
-
},
|
15
|
-
"home_page": {
|
16
|
-
"href": "http://sagartestmovie.crystal.dev/packages/testing123"
|
17
|
-
}
|
18
|
-
},
|
19
|
-
"_embedded": {
|
20
|
-
"site": {
|
21
|
-
"_links": {
|
22
|
-
"self": {
|
23
|
-
"href": "http://api.crystal.dev/sites/1900"
|
24
|
-
},
|
25
|
-
"home_page": {
|
26
|
-
"href": "http://sagartestmovie.crystal.dev"
|
27
|
-
},
|
28
|
-
"followers": {
|
29
|
-
"href": "http://api.crystal.dev/sites/1900/followers"
|
30
|
-
}
|
31
|
-
},
|
32
|
-
"id": 1900,
|
33
|
-
"title": "SagarTestMovie",
|
34
|
-
"description": "This is my test movie. ",
|
35
|
-
"domain": "sagartestmovie.crystal.dev",
|
36
|
-
"subdomain": "sagartestmovie",
|
37
|
-
"key": "sagartestmovie",
|
38
|
-
"color": "#28DBF7",
|
39
|
-
"facebook_url": null,
|
40
|
-
"twitter_name": null,
|
41
|
-
"google_analytics_id": "",
|
42
|
-
"packages_count": 2,
|
43
|
-
"videos_count": 4,
|
44
|
-
"followers_count": 31,
|
45
|
-
"created_at": "2013-12-27T00:20:28Z",
|
46
|
-
"updated_at": "2015-05-04T20:46:01Z"
|
47
|
-
},
|
48
|
-
"videos": [
|
49
|
-
{
|
50
|
-
"_links": {
|
51
|
-
"self": {
|
52
|
-
"href": "http://api.crystal.dev/videos/3008"
|
53
|
-
},
|
54
|
-
"site": {
|
55
|
-
"href": "http://api.crystal.dev/sites/1900"
|
56
|
-
},
|
57
|
-
"files": {
|
58
|
-
"href": "http://api.crystal.dev/videos/3008/files"
|
59
|
-
}
|
60
|
-
},
|
61
|
-
"_embedded": {
|
62
|
-
"subtitles": [
|
63
|
-
{
|
64
|
-
"_links": {
|
65
|
-
"self": {
|
66
|
-
"href": "http://api.crystal.dev/videos/7726"
|
67
|
-
},
|
68
|
-
"video": {
|
69
|
-
"href": "http://api.crystal.dev/videos/3008"
|
70
|
-
},
|
71
|
-
"site": {
|
72
|
-
"href": "http://api.crystal.dev/sites/1900"
|
73
|
-
}
|
74
|
-
},
|
75
|
-
"language": "Bengali",
|
76
|
-
"type": "video"
|
77
|
-
},
|
78
|
-
{
|
79
|
-
"_links": {
|
80
|
-
"self": {
|
81
|
-
"href": "http://api.crystal.dev/videos/5558"
|
82
|
-
},
|
83
|
-
"video": {
|
84
|
-
"href": "http://api.crystal.dev/videos/3008"
|
85
|
-
},
|
86
|
-
"site": {
|
87
|
-
"href": "http://api.crystal.dev/sites/1900"
|
88
|
-
}
|
89
|
-
},
|
90
|
-
"language": "English",
|
91
|
-
"type": "video"
|
92
|
-
}
|
93
|
-
]
|
94
|
-
},
|
95
|
-
"id": 3008,
|
96
|
-
"title": "Test Movie",
|
97
|
-
"description": "Testing",
|
98
|
-
"status": "uploaded",
|
99
|
-
"duration": {
|
100
|
-
"seconds": 19,
|
101
|
-
"formatted": "00:00:19"
|
102
|
-
},
|
103
|
-
"thumbnail": {
|
104
|
-
"small": "https://dv6n47kh00ig2.cloudfront.net/sagartestmovie/assets/images/video-3008-1403716255-240x135.jpg",
|
105
|
-
"medium": "https://dv6n47kh00ig2.cloudfront.net/sagartestmovie/assets/images/video-3008-1403716255-640x360.jpg",
|
106
|
-
"large": "https://dv6n47kh00ig2.cloudfront.net/sagartestmovie/assets/images/video-3008-1403716255-1280x720.jpg"
|
107
|
-
},
|
108
|
-
"is_drm_enabled": false,
|
109
|
-
"subtitles_count": 2,
|
110
|
-
"files_count": 5,
|
111
|
-
"created_at": "2014-02-06T05:30:18Z",
|
112
|
-
"updated_at": "2015-02-18T16:21:24Z",
|
113
|
-
"position": 0
|
114
|
-
},
|
115
|
-
{
|
116
|
-
"_links": {
|
117
|
-
"self": {
|
118
|
-
"href": "http://api.crystal.dev/videos/7830"
|
119
|
-
},
|
120
|
-
"site": {
|
121
|
-
"href": "http://api.crystal.dev/sites/1900"
|
122
|
-
},
|
123
|
-
"files": {
|
124
|
-
"href": "http://api.crystal.dev/videos/7830/files"
|
125
|
-
}
|
126
|
-
},
|
127
|
-
"_embedded": {
|
128
|
-
"subtitles": [
|
129
|
-
|
130
|
-
]
|
131
|
-
},
|
132
|
-
"id": 7830,
|
133
|
-
"title": "test movie",
|
134
|
-
"description": null,
|
135
|
-
"status": null,
|
136
|
-
"duration": {
|
137
|
-
"seconds": 0,
|
138
|
-
"formatted": "00:00:00"
|
139
|
-
},
|
140
|
-
"thumbnail": {
|
141
|
-
"small": "http://cdn.crystal.dev/assets/thumbnails/default-small.png",
|
142
|
-
"medium": "http://cdn.crystal.dev/assets/thumbnails/default-medium.png",
|
143
|
-
"large": "http://cdn.crystal.dev/assets/thumbnails/default-large.png"
|
144
|
-
},
|
145
|
-
"is_drm_enabled": false,
|
146
|
-
"subtitles_count": 0,
|
147
|
-
"files_count": 0,
|
148
|
-
"created_at": "2014-07-14T15:19:03Z",
|
149
|
-
"updated_at": "2015-05-04T19:36:50Z",
|
150
|
-
"position": 1
|
151
|
-
}
|
152
|
-
],
|
153
|
-
"trailer": null
|
154
|
-
},
|
155
|
-
"id": 1025,
|
156
|
-
"title": "testing123",
|
157
|
-
"description": "test",
|
158
|
-
"sku": "testing123",
|
159
|
-
"price": {
|
160
|
-
"cents": 200,
|
161
|
-
"currency": "USD",
|
162
|
-
"formatted": "$2",
|
163
|
-
"US": {
|
164
|
-
"cents": 200,
|
165
|
-
"currency": "USD",
|
166
|
-
"formatted": "$2"
|
167
|
-
}
|
168
|
-
},
|
169
|
-
"rental": null,
|
170
|
-
"trailer_url": null,
|
171
|
-
"trailer_embed_code": "<iframe src=\"http://embed.crystal.dev/packages/1025\" width=\"640\" height=\"360\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>",
|
172
|
-
"thumbnail": {
|
173
|
-
"small": "http://cdn.crystal.dev/assets/thumbnails/default-small.png",
|
174
|
-
"medium": "http://cdn.crystal.dev/assets/thumbnails/default-medium.png",
|
175
|
-
"large": "http://cdn.crystal.dev/assets/thumbnails/default-large.png",
|
176
|
-
"blurred": null
|
177
|
-
},
|
178
|
-
"is_active": false,
|
179
|
-
"is_preorder": false,
|
180
|
-
"release_date": null,
|
181
|
-
"videos_count": 2,
|
182
|
-
"extras_count": 0,
|
183
|
-
"created_at": "2014-02-06T18:00:39Z",
|
184
|
-
"updated_at": "2015-02-18T16:21:15Z"
|
185
|
-
}
|
data/spec/objects/file_spec.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Vhx::File, :vcr do
|
4
|
-
let(:sample_file_response){ JSON.parse(File.read("spec/fixtures/sample_file_response.json")) }
|
5
|
-
let(:vhx_file){Vhx::File.new(sample_file_response)}
|
6
|
-
|
7
|
-
before {
|
8
|
-
Vhx.setup(test_credentials)
|
9
|
-
}
|
10
|
-
|
11
|
-
describe 'attributes' do
|
12
|
-
it 'are present' do
|
13
|
-
expect(vhx_file.created_at).to_not be_nil
|
14
|
-
expect(vhx_file.quality).to_not be_nil
|
15
|
-
expect(vhx_file.mime_type).to_not be_nil
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'associations' do
|
20
|
-
it 'are present' do
|
21
|
-
expect(vhx_file.video).to_not raise_error(NoMethodError)
|
22
|
-
expect(vhx_file.site).to_not raise_error(NoMethodError)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'errors if not present' do
|
26
|
-
expect{vhx_file.file}.to raise_error(NoMethodError)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Vhx::Package, :vcr do
|
4
|
-
let(:sample_package_response){ JSON.parse(File.read("spec/fixtures/sample_package_response.json")) }
|
5
|
-
let(:vhx_package){Vhx::Package.new(sample_package_response)}
|
6
|
-
|
7
|
-
before {
|
8
|
-
Vhx.setup(test_credentials)
|
9
|
-
}
|
10
|
-
|
11
|
-
describe '::find' do
|
12
|
-
it 'with id' do
|
13
|
-
expect(Vhx::Package.find(1025)).to be_instance_of(Vhx::Package)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'with hypermedia' do
|
17
|
-
expect(Vhx::Package.find('http://api.crystal.dev/packages/1025')).to be_instance_of(Vhx::Package)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '::create' do
|
22
|
-
it 'returns package object' do
|
23
|
-
attributes = {title: 'test package', description: 'test description', price_cents: 1000, site: "http://api.crystal.dev/sites/1900"}
|
24
|
-
expect(Vhx::Package.create(attributes)).to be_instance_of(Vhx::Package)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#add_video' do
|
29
|
-
context 'with id' do
|
30
|
-
it 'returns package object' do
|
31
|
-
expect(vhx_package.add_video(7830)).to be_instance_of(Vhx::Package)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'with hypermedia' do
|
36
|
-
it 'returns package object' do
|
37
|
-
expect(vhx_package.add_video('http://api.crystal.dev/videos/7830')).to be_instance_of(Vhx::Package)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#remove_video' do
|
43
|
-
context 'with id' do
|
44
|
-
it 'returns success' do
|
45
|
-
expect(vhx_package.remove_video(7726)).to be_instance_of(Vhx::Package)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'with hypermedia' do
|
50
|
-
it 'returns success' do
|
51
|
-
expect(vhx_package.remove_video('http://api.crystal.dev/videos/7726')).to be_instance_of(Vhx::Package)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe 'attributes' do
|
57
|
-
it 'are present' do
|
58
|
-
expect(vhx_package.id).to_not be_nil
|
59
|
-
expect(vhx_package.title).to_not be_nil
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe 'associations' do
|
64
|
-
it 'are present' do
|
65
|
-
expect{vhx_package.site}.to_not raise_error(NoMethodError)
|
66
|
-
expect{vhx_package.videos}.to_not raise_error(NoMethodError)
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'errors if not present' do
|
70
|
-
expect{vhx_package.package}.to raise_error(NoMethodError)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|