vhx-ruby 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +2 -0
  5. data/README.md +59 -0
  6. data/Rakefile +1 -0
  7. data/lib/vhx.rb +66 -0
  8. data/lib/vhx/client.rb +86 -0
  9. data/lib/vhx/error.rb +24 -0
  10. data/lib/vhx/middleware/error_response.rb +32 -0
  11. data/lib/vhx/middleware/oauth2.rb +22 -0
  12. data/lib/vhx/oauth_token.rb +11 -0
  13. data/lib/vhx/objects/authorization.rb +5 -0
  14. data/lib/vhx/objects/collection.rb +8 -0
  15. data/lib/vhx/objects/collection_item.rb +4 -0
  16. data/lib/vhx/objects/customer.rb +8 -0
  17. data/lib/vhx/objects/product.rb +6 -0
  18. data/lib/vhx/objects/site.rb +4 -0
  19. data/lib/vhx/objects/user.rb +10 -0
  20. data/lib/vhx/objects/video.rb +7 -0
  21. data/lib/vhx/objects/video_file.rb +4 -0
  22. data/lib/vhx/utilities/api_operations/create.rb +22 -0
  23. data/lib/vhx/utilities/api_operations/delete.rb +16 -0
  24. data/lib/vhx/utilities/api_operations/list.rb +21 -0
  25. data/lib/vhx/utilities/api_operations/request.rb +17 -0
  26. data/lib/vhx/utilities/api_operations/update.rb +15 -0
  27. data/lib/vhx/utilities/vhx_helper.rb +20 -0
  28. data/lib/vhx/utilities/vhx_list_object.rb +44 -0
  29. data/lib/vhx/utilities/vhx_object.rb +106 -0
  30. data/lib/vhx/version.rb +3 -0
  31. data/spec/client_spec.rb +69 -0
  32. data/spec/fixtures/sample_array_list.json +15 -0
  33. data/spec/fixtures/sample_file_response.json +18 -0
  34. data/spec/fixtures/sample_hash_list.json +23 -0
  35. data/spec/fixtures/sample_package_response.json +185 -0
  36. data/spec/fixtures/sample_site_response.json +26 -0
  37. data/spec/fixtures/sample_user_response.json +21 -0
  38. data/spec/fixtures/sample_video_response.json +51 -0
  39. data/spec/middleware/error_response_spec.rb +11 -0
  40. data/spec/middleware/oauth2_spec.rb +14 -0
  41. data/spec/objects/file_spec.rb +29 -0
  42. data/spec/objects/package_spec.rb +74 -0
  43. data/spec/objects/site_spec.rb +44 -0
  44. data/spec/objects/user_spec.rb +51 -0
  45. data/spec/objects/video_spec.rb +36 -0
  46. data/spec/spec_helper.rb +18 -0
  47. data/spec/test_data.rb +55 -0
  48. data/spec/utilities/vhx_collection_spec.rb +27 -0
  49. data/spec/utilities/vhx_helper_spec.rb +47 -0
  50. data/spec/utilities/vhx_object_spec.rb +53 -0
  51. data/spec/vcr/Vhx_Client/application_user/_refresh_access_token/access_token_changed.yml +57 -0
  52. data/spec/vcr/Vhx_Client/application_user/_refresh_access_token/oauth_token_refreshed.yml +57 -0
  53. data/spec/vcr/Vhx_File/associations/are_present.yml +409 -0
  54. data/spec/vcr/Vhx_Middleware_ErrorResponse/unauthorized_user_credentials.yml +122 -0
  55. data/spec/vcr/Vhx_Middleware_OAuth2/access_token_refresh.yml +797 -0
  56. data/spec/vcr/Vhx_Package/_add_video/with_hypermedia/returns_package_object.yml +51 -0
  57. data/spec/vcr/Vhx_Package/_add_video/with_id/returns_package_object.yml +51 -0
  58. data/spec/vcr/Vhx_Package/_create/returns_package_object.yml +140 -0
  59. data/spec/vcr/Vhx_Package/_find/with_hypermedia.yml +243 -0
  60. data/spec/vcr/Vhx_Package/_find/with_id.yml +243 -0
  61. data/spec/vcr/Vhx_Package/_remove_video/with_hypermedia/returns_success.yml +51 -0
  62. data/spec/vcr/Vhx_Package/_remove_video/with_id/returns_success.yml +51 -0
  63. data/spec/vcr/Vhx_Package/associations/are_present.yml +195 -0
  64. data/spec/vcr/Vhx_Site/_create/returns_site_object.yml +91 -0
  65. data/spec/vcr/Vhx_Site/_find/with_hypermedia.yml +195 -0
  66. data/spec/vcr/Vhx_Site/_find/with_id.yml +195 -0
  67. data/spec/vcr/Vhx_User/_find/with_hypermedia.yml +81 -0
  68. data/spec/vcr/Vhx_User/_find/with_id.yml +81 -0
  69. data/spec/vcr/Vhx_User/_me/returns_user_object.yml +720 -0
  70. data/spec/vcr/Vhx_User/_update/returns_user_object.yml +212 -0
  71. data/spec/vcr/Vhx_VhxObject/associations/cache/retreive_if_available.yml +195 -0
  72. data/spec/vcr/Vhx_VhxObject/associations/falls_back_to_links.yml +310 -0
  73. data/spec/vcr/Vhx_Video/_create/returns_video_object.yml +125 -0
  74. data/spec/vcr/Vhx_Video/associations/are_present.yml +294 -0
  75. data/vhx.gemspec +27 -0
  76. metadata +204 -0
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vhx::VhxListObject do
4
+ let(:sample_hash_list){ JSON.parse(File.read("spec/fixtures/sample_hash_list.json")) }
5
+ let(:sample_array_list){ JSON.parse(File.read("spec/fixtures/sample_array_list.json")) }
6
+
7
+ context 'hash list' do
8
+ it 'has #previous, #next methods based on _links' do
9
+ expect(Vhx::VhxListObject.new(sample_hash_list, 'files').next).to eq 'pending'
10
+ expect(Vhx::VhxListObject.new(sample_hash_list, 'files').previous).to eq 'pending'
11
+ end
12
+
13
+ it 'makes call to url in #previous, #next' do
14
+ pending
15
+ end
16
+
17
+ it 'builds array from _embedded' do
18
+ expect(Vhx::VhxListObject.new(sample_hash_list, 'files').kind_of?(Array)).to eq true
19
+ end
20
+ end
21
+
22
+ context 'array list' do
23
+ it 'builds array from parameter' do
24
+ expect(Vhx::VhxListObject.new(sample_array_list, 'files').kind_of?(Array)).to eq true
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vhx::HelperMethods do
4
+ let(:sample_user_response){ JSON.parse(File.read("spec/fixtures/sample_user_response.json")) }
5
+ let(:vhx_object){Vhx::User.new(sample_user_response)}
6
+
7
+ describe '#get_klass' do
8
+ context 'class method' do
9
+ it 'determines class' do
10
+ expect(Vhx::User.get_klass).to eq('User')
11
+ end
12
+ end
13
+
14
+ context 'instance method' do
15
+ it 'determines class' do
16
+ expect(vhx_object.get_klass).to eq('User')
17
+ end
18
+ end
19
+ end
20
+
21
+ describe '#get_hypermedia' do
22
+ context 'hypermedia parameter' do
23
+ it 'returns hypermedia parameter' do
24
+ expect(Vhx::User.get_hypermedia('http://api.crystal.dev/users/1560703')).to eq 'http://api.crystal.dev/users/1560703'
25
+ end
26
+ end
27
+
28
+ context 'id parameter' do
29
+ it 'converts to hypermedia path' do
30
+ expect(vhx_object.get_hypermedia(1560703)).to eq '/users/1560703'
31
+ end
32
+
33
+ context 'klass specified' do
34
+ it 'applies klass parameter' do
35
+ expect(vhx_object.get_hypermedia(1560703, 'Video')).to eq '/videos/1560703'
36
+ end
37
+ end
38
+
39
+ context 'klass not specified' do
40
+ it 'determines klass' do
41
+ expect(vhx_object.get_hypermedia(1560703)).to eq '/users/1560703'
42
+ end
43
+ end
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vhx::VhxObject, :vcr do
4
+ let(:sample_package_response){ JSON.parse(File.read("spec/fixtures/sample_package_response.json")) }
5
+ let(:vhx_object_with_embedded){Vhx::Package.new(sample_package_response)}
6
+ let(:vhx_object_without_embedded){sample_package_response['_embedded'] = {}; Vhx::Package.new(sample_package_response);}
7
+
8
+ describe '#validate_class' do
9
+ it 'raises error' do
10
+ expect{Vhx::VhxObject.new(sample_package_response)}.to raise_error(Vhx::InvalidResourceError)
11
+ end
12
+
13
+ it 'succeeds' do
14
+ expect(Vhx::Package.new(sample_package_response)).to be_instance_of(Vhx::Package)
15
+ end
16
+ end
17
+
18
+ describe 'associations' do
19
+ before {
20
+ Vhx.setup(test_credentials)
21
+ }
22
+
23
+ it 'default to embedded' do
24
+ Faraday::Connection.any_instance.should_not_receive(:get)
25
+ expect(vhx_object_with_embedded.site).to be_instance_of Vhx::Site
26
+ end
27
+
28
+ it 'falls back to links' do
29
+ Faraday::Connection.any_instance.should_receive(:get).and_call_original
30
+ expect(vhx_object_without_embedded.site).to be_instance_of Vhx::Site
31
+ end
32
+
33
+ describe 'cache' do
34
+ it 'retreive if available' do
35
+ vhx_object_without_embedded.site
36
+ Faraday::Connection.any_instance.should_not_receive(:get)
37
+ expect(vhx_object_without_embedded.site).to be_instance_of Vhx::Site
38
+ end
39
+ end
40
+
41
+ describe 'has_many' do
42
+ it 'returns VhxListObject object' do
43
+ expect(vhx_object_with_embedded.videos).to be_instance_of Vhx::VhxListObject
44
+ end
45
+ end
46
+
47
+ describe 'has_one' do
48
+ it 'returns resource object' do
49
+ expect(vhx_object_with_embedded.site).to be_instance_of Vhx::Site
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.crystal.dev/oauth/token
6
+ body:
7
+ encoding: UTF-8
8
+ string: client_id=7ed37300580e27f1acb5f16112e91aba43931d1e8e8c9829cc0fc36358f2cd44&client_secret=ce0fc20cad4cb74b4e5c30803446066b6d8556f413217a6a102aaab03372ac77&grant_type=refresh_token&refresh_token=132916e95bacc977a7890b31bf608e3d641d8a5c19b4ff4ffcf50e5b4273ed99
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
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
+ - Wed, 29 Apr 2015 16:56:24 GMT
25
+ Status:
26
+ - 200 OK
27
+ Connection:
28
+ - close
29
+ Cache-Control:
30
+ - no-store
31
+ Pragma:
32
+ - no-cache
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Vary:
36
+ - Accept-Encoding
37
+ X-Ua-Compatible:
38
+ - IE=Edge
39
+ Etag:
40
+ - '"2c27333be5b32867ad2568f15bc55d38"'
41
+ Set-Cookie:
42
+ - _session=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiJTVlZjE4MDVkZTU2YTA2N2UxMGY2MTBmNDYyYzdmZGM5BjsAVA%3D%3D--fce39509de4c52685c9dde3a238ac4f4c77ca18f;
43
+ domain=.crystal.dev; path=/; expires=Fri, 29-Apr-2016 16:56:24 GMT; HttpOnly
44
+ X-Meta-Request-Version:
45
+ - 0.3.4
46
+ X-Request-Id:
47
+ - 608f6c9df5cbf6c4191aa0dd1ba3eb17
48
+ X-Runtime:
49
+ - '0.331092'
50
+ Transfer-Encoding:
51
+ - chunked
52
+ body:
53
+ encoding: UTF-8
54
+ string: '{"access_token":"a4ca40067efd7e31535accdc2ac32010dc06b152f1981df938cc7afa14fc9ee9","token_type":"bearer","expires_in":7200,"refresh_token":"dd7204af2df5fe5d961c9d91cba67a14dca226022d1d7caa4da2b4a2b23fa08e","scope":"public"}'
55
+ http_version:
56
+ recorded_at: Wed, 29 Apr 2015 16:56:24 GMT
57
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.crystal.dev/oauth/token
6
+ body:
7
+ encoding: UTF-8
8
+ string: client_id=7ed37300580e27f1acb5f16112e91aba43931d1e8e8c9829cc0fc36358f2cd44&client_secret=ce0fc20cad4cb74b4e5c30803446066b6d8556f413217a6a102aaab03372ac77&grant_type=refresh_token&refresh_token=132916e95bacc977a7890b31bf608e3d641d8a5c19b4ff4ffcf50e5b4273ed99
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
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
+ - Wed, 29 Apr 2015 16:56:24 GMT
25
+ Status:
26
+ - 200 OK
27
+ Connection:
28
+ - close
29
+ Cache-Control:
30
+ - no-store
31
+ Pragma:
32
+ - no-cache
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Vary:
36
+ - Accept-Encoding
37
+ X-Ua-Compatible:
38
+ - IE=Edge
39
+ Etag:
40
+ - '"2c27333be5b32867ad2568f15bc55d38"'
41
+ Set-Cookie:
42
+ - _session=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiJTVlZjE4MDVkZTU2YTA2N2UxMGY2MTBmNDYyYzdmZGM5BjsAVA%3D%3D--fce39509de4c52685c9dde3a238ac4f4c77ca18f;
43
+ domain=.crystal.dev; path=/; expires=Fri, 29-Apr-2016 16:56:24 GMT; HttpOnly
44
+ X-Meta-Request-Version:
45
+ - 0.3.4
46
+ X-Request-Id:
47
+ - 608f6c9df5cbf6c4191aa0dd1ba3eb17
48
+ X-Runtime:
49
+ - '0.331092'
50
+ Transfer-Encoding:
51
+ - chunked
52
+ body:
53
+ encoding: UTF-8
54
+ string: '{"access_token":"a4ca40067efd7e31535accdc2ac32010dc06b152f1981df938cc7afa14fc9ee9","token_type":"bearer","expires_in":7200,"refresh_token":"dd7204af2df5fe5d961c9d91cba67a14dca226022d1d7caa4da2b4a2b23fa08e","scope":"public"}'
55
+ http_version:
56
+ recorded_at: Wed, 29 Apr 2015 16:56:24 GMT
57
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,409 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.crystal.dev/videos/3008
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:08:07 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
+ - videos/3008 sites/1900
35
+ Etag:
36
+ - '"46aceb0e0092d7c2f0738be22c7ef992"'
37
+ Last-Modified:
38
+ - Wed, 18 Feb 2015 16:21:24 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
+ - 0d42a5a9006bc9a715a91ed5f8d39103
49
+ X-Runtime:
50
+ - '0.866176'
51
+ Transfer-Encoding:
52
+ - chunked
53
+ body:
54
+ encoding: UTF-8
55
+ string: |
56
+ {
57
+ "_links": {
58
+ "self": {
59
+ "href": "http://api.crystal.dev/videos/3008"
60
+ },
61
+ "site": {
62
+ "href": "http://api.crystal.dev/sites/1900"
63
+ },
64
+ "files": {
65
+ "href": "http://api.crystal.dev/videos/3008/files"
66
+ }
67
+ },
68
+ "_embedded": {
69
+ "site": {
70
+ "_links": {
71
+ "self": {
72
+ "href": "http://api.crystal.dev/sites/1900"
73
+ },
74
+ "home_page": {
75
+ "href": "http://sagartestmovie.crystal.dev"
76
+ },
77
+ "followers": {
78
+ "href": "http://api.crystal.dev/sites/1900/followers"
79
+ }
80
+ },
81
+ "id": 1900,
82
+ "title": "SagarTestMovie",
83
+ "description": "This is my test movie. ",
84
+ "domain": "sagartestmovie.crystal.dev",
85
+ "subdomain": "sagartestmovie",
86
+ "key": "sagartestmovie",
87
+ "color": "#28DBF7",
88
+ "facebook_url": null,
89
+ "twitter_name": null,
90
+ "google_analytics_id": "",
91
+ "packages_count": 1,
92
+ "videos_count": 3,
93
+ "followers_count": 30,
94
+ "created_at": "2013-12-27T00:20:28Z",
95
+ "updated_at": "2015-04-30T18:17:22Z"
96
+ },
97
+ "subtitles": [
98
+ {
99
+ "_links": {
100
+ "self": {
101
+ "href": "http://api.crystal.dev/videos/7726"
102
+ },
103
+ "video": {
104
+ "href": "http://api.crystal.dev/videos/3008"
105
+ },
106
+ "site": {
107
+ "href": "http://api.crystal.dev/sites/1900"
108
+ }
109
+ },
110
+ "language": "Bengali",
111
+ "type": "video"
112
+ },
113
+ {
114
+ "_links": {
115
+ "self": {
116
+ "href": "http://api.crystal.dev/videos/5558"
117
+ },
118
+ "video": {
119
+ "href": "http://api.crystal.dev/videos/3008"
120
+ },
121
+ "site": {
122
+ "href": "http://api.crystal.dev/sites/1900"
123
+ }
124
+ },
125
+ "language": "English",
126
+ "type": "video"
127
+ }
128
+ ],
129
+ "files": [
130
+ {
131
+ "_links": {
132
+ "self": {
133
+ "href": "http://api.crystal.dev/videos/3008/files?format=m3u8&quality=adaptive"
134
+ },
135
+ "video": {
136
+ "href": "http://api.crystal.dev/videos/3008"
137
+ },
138
+ "site": {
139
+ "href": "http://api.crystal.dev/sites/1900"
140
+ }
141
+ },
142
+ "size": {
143
+ "bytes": 443,
144
+ "formatted": "443 Bytes"
145
+ },
146
+ "quality": "adaptive",
147
+ "format": "m3u8",
148
+ "method": "hls",
149
+ "mime_type": "application/x-mpegURL",
150
+ "created_at": "2014-02-06T05:30:51Z",
151
+ "updated_at": "2014-02-06T05:32:32Z"
152
+ },
153
+ {
154
+ "_links": {
155
+ "self": {
156
+ "href": "http://api.crystal.dev/videos/3008/files?format=mp4&quality=720p"
157
+ },
158
+ "video": {
159
+ "href": "http://api.crystal.dev/videos/3008"
160
+ },
161
+ "site": {
162
+ "href": "http://api.crystal.dev/sites/1900"
163
+ }
164
+ },
165
+ "size": {
166
+ "bytes": 643267,
167
+ "formatted": "628 KB"
168
+ },
169
+ "quality": "720p",
170
+ "format": "mp4",
171
+ "method": "progressive",
172
+ "mime_type": "video/mp4",
173
+ "created_at": "2014-02-06T05:30:50Z",
174
+ "updated_at": "2014-02-06T05:32:32Z"
175
+ },
176
+ {
177
+ "_links": {
178
+ "self": {
179
+ "href": "http://api.crystal.dev/videos/3008/files?format=mp4&quality=540p"
180
+ },
181
+ "video": {
182
+ "href": "http://api.crystal.dev/videos/3008"
183
+ },
184
+ "site": {
185
+ "href": "http://api.crystal.dev/sites/1900"
186
+ }
187
+ },
188
+ "size": {
189
+ "bytes": 624384,
190
+ "formatted": "610 KB"
191
+ },
192
+ "quality": "540p",
193
+ "format": "mp4",
194
+ "method": "progressive",
195
+ "mime_type": "video/mp4",
196
+ "created_at": "2014-02-06T05:30:50Z",
197
+ "updated_at": "2014-02-06T05:32:32Z"
198
+ },
199
+ {
200
+ "_links": {
201
+ "self": {
202
+ "href": "http://api.crystal.dev/videos/3008/files?format=flv&quality=720p"
203
+ },
204
+ "video": {
205
+ "href": "http://api.crystal.dev/videos/3008"
206
+ },
207
+ "site": {
208
+ "href": "http://api.crystal.dev/sites/1900"
209
+ }
210
+ },
211
+ "size": {
212
+ "bytes": 662809,
213
+ "formatted": "647 KB"
214
+ },
215
+ "quality": "720p",
216
+ "format": "flv",
217
+ "method": null,
218
+ "mime_type": null,
219
+ "created_at": "2014-02-06T05:30:50Z",
220
+ "updated_at": "2014-02-06T05:32:32Z"
221
+ },
222
+ {
223
+ "_links": {
224
+ "self": {
225
+ "href": "http://api.crystal.dev/videos/3008/files?format=flv&quality=540p"
226
+ },
227
+ "video": {
228
+ "href": "http://api.crystal.dev/videos/3008"
229
+ },
230
+ "site": {
231
+ "href": "http://api.crystal.dev/sites/1900"
232
+ }
233
+ },
234
+ "size": {
235
+ "bytes": 643926,
236
+ "formatted": "629 KB"
237
+ },
238
+ "quality": "540p",
239
+ "format": "flv",
240
+ "method": null,
241
+ "mime_type": null,
242
+ "created_at": "2014-02-06T05:30:51Z",
243
+ "updated_at": "2014-02-06T05:32:32Z"
244
+ }
245
+ ],
246
+ "transcode": null
247
+ },
248
+ "id": 3008,
249
+ "title": "Test Movie",
250
+ "description": "Testing",
251
+ "status": "uploaded",
252
+ "duration": {
253
+ "seconds": 19,
254
+ "formatted": "00:00:19"
255
+ },
256
+ "thumbnail": {
257
+ "small": "https://dv6n47kh00ig2.cloudfront.net/sagartestmovie/assets/images/video-3008-1403716255-240x135.jpg",
258
+ "medium": "https://dv6n47kh00ig2.cloudfront.net/sagartestmovie/assets/images/video-3008-1403716255-640x360.jpg",
259
+ "large": "https://dv6n47kh00ig2.cloudfront.net/sagartestmovie/assets/images/video-3008-1403716255-1280x720.jpg"
260
+ },
261
+ "is_drm_enabled": false,
262
+ "subtitles_count": 2,
263
+ "files_count": 5,
264
+ "created_at": "2014-02-06T05:30:18Z",
265
+ "updated_at": "2015-02-18T16:21:24Z"
266
+ }
267
+ http_version:
268
+ recorded_at: Mon, 04 May 2015 19:08:07 GMT
269
+ - request:
270
+ method: get
271
+ uri: http://api.crystal.dev/sites/1900
272
+ body:
273
+ encoding: US-ASCII
274
+ string: ''
275
+ headers:
276
+ Authorization:
277
+ - Bearer 41d2ed8ead125347d38cf13dd7da8df0a32e9c9e839a9ea1b39c0d4f8b9caa92
278
+ User-Agent:
279
+ - Faraday v0.9.1
280
+ Accept-Encoding:
281
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
282
+ Accept:
283
+ - "*/*"
284
+ response:
285
+ status:
286
+ code: 200
287
+ message: OK
288
+ headers:
289
+ Date:
290
+ - Mon, 04 May 2015 19:08:08 GMT
291
+ Status:
292
+ - 200 OK
293
+ Connection:
294
+ - close
295
+ Cache-Control:
296
+ - public, no-cache, must-revalidate
297
+ Surrogate-Control:
298
+ - max-age=3600
299
+ Surrogate-Key:
300
+ - sites/1900
301
+ Etag:
302
+ - '"2be7fb00bf9ac7c2f2aa8e54bdf25b03"'
303
+ Last-Modified:
304
+ - Thu, 30 Apr 2015 18:17:22 GMT
305
+ Content-Type:
306
+ - application/json; charset=utf-8
307
+ Vary:
308
+ - Accept-Encoding
309
+ X-Ua-Compatible:
310
+ - IE=Edge
311
+ X-Meta-Request-Version:
312
+ - 0.3.4
313
+ X-Request-Id:
314
+ - 4bbd1daf14474ff58c6bc0e074682fce
315
+ X-Runtime:
316
+ - '0.589578'
317
+ Transfer-Encoding:
318
+ - chunked
319
+ body:
320
+ encoding: UTF-8
321
+ string: |
322
+ {
323
+ "_links": {
324
+ "self": {
325
+ "href": "http://api.crystal.dev/sites/1900"
326
+ },
327
+ "home_page": {
328
+ "href": "http://sagartestmovie.crystal.dev"
329
+ },
330
+ "followers": {
331
+ "href": "http://api.crystal.dev/sites/1900/followers"
332
+ }
333
+ },
334
+ "_embedded": {
335
+ "subscription": null,
336
+ "packages": [
337
+ {
338
+ "_links": {
339
+ "self": {
340
+ "href": "http://api.crystal.dev/packages/2780"
341
+ },
342
+ "site": {
343
+ "href": "http://api.crystal.dev/sites/1900"
344
+ },
345
+ "videos": {
346
+ "href": "http://api.crystal.dev/packages/2780/videos"
347
+ },
348
+ "buy_page": {
349
+ "href": "http://sagartestmovie.crystal.dev/buy/pwyw-1"
350
+ },
351
+ "home_page": {
352
+ "href": "http://sagartestmovie.crystal.dev/packages/pwyw-1"
353
+ }
354
+ },
355
+ "_embedded": {
356
+ "trailer": null
357
+ },
358
+ "id": 2780,
359
+ "title": "pwyw",
360
+ "description": "",
361
+ "sku": "pwyw-1",
362
+ "price": {
363
+ "cents": 500,
364
+ "currency": "USD",
365
+ "formatted": "$5",
366
+ "US": {
367
+ "cents": 500,
368
+ "currency": "USD",
369
+ "formatted": "$5"
370
+ }
371
+ },
372
+ "rental": null,
373
+ "trailer_url": null,
374
+ "trailer_embed_code": "<iframe src=\"http://embed.crystal.dev/packages/2780\" width=\"640\" height=\"360\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>",
375
+ "thumbnail": {
376
+ "small": "http://cdn.crystal.dev/assets/thumbnails/default-small.png",
377
+ "medium": "http://cdn.crystal.dev/assets/thumbnails/default-medium.png",
378
+ "large": "http://cdn.crystal.dev/assets/thumbnails/default-large.png",
379
+ "blurred": null
380
+ },
381
+ "is_active": true,
382
+ "is_preorder": false,
383
+ "release_date": null,
384
+ "videos_count": 0,
385
+ "extras_count": 0,
386
+ "created_at": "2014-07-15T18:15:36Z",
387
+ "updated_at": "2014-08-26T14:48:52Z"
388
+ }
389
+ ]
390
+ },
391
+ "id": 1900,
392
+ "title": "SagarTestMovie",
393
+ "description": "This is my test movie. ",
394
+ "domain": "sagartestmovie.crystal.dev",
395
+ "subdomain": "sagartestmovie",
396
+ "key": "sagartestmovie",
397
+ "color": "#28DBF7",
398
+ "facebook_url": null,
399
+ "twitter_name": null,
400
+ "google_analytics_id": "",
401
+ "packages_count": 1,
402
+ "videos_count": 3,
403
+ "followers_count": 30,
404
+ "created_at": "2013-12-27T00:20:28Z",
405
+ "updated_at": "2015-04-30T18:17:22Z"
406
+ }
407
+ http_version:
408
+ recorded_at: Mon, 04 May 2015 19:08:08 GMT
409
+ recorded_with: VCR 2.9.3