vzaar_api 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.rspec +4 -0
  4. data/.tool-versions +1 -0
  5. data/.travis.yml +3 -0
  6. data/Changelog +50 -0
  7. data/Gemfile +3 -0
  8. data/Guardfile +25 -0
  9. data/README.md +55 -0
  10. data/Rakefile +26 -0
  11. data/examples/README.md +33 -0
  12. data/examples/api_envs.yml.example +31 -0
  13. data/examples/category/create_update_delete_spec.rb +100 -0
  14. data/examples/category/list_spec.rb +38 -0
  15. data/examples/category/list_subtree_spec.rb +40 -0
  16. data/examples/category/lookup_spec.rb +35 -0
  17. data/examples/encoding_preset/list_spec.rb +38 -0
  18. data/examples/encoding_preset/lookup_spec.rb +35 -0
  19. data/examples/ingest_recipe/create_update_delete_spec.rb +70 -0
  20. data/examples/ingest_recipe/list_spec.rb +38 -0
  21. data/examples/ingest_recipe/lookup_spec.rb +35 -0
  22. data/examples/playlist/create_update_delete_spec.rb +97 -0
  23. data/examples/playlist/list_spec.rb +37 -0
  24. data/examples/playlist/lookup_spec.rb +34 -0
  25. data/examples/rate_limit_spec.rb +18 -0
  26. data/examples/spec_helper.rb +17 -0
  27. data/examples/support/helpers.rb +16 -0
  28. data/examples/support/videos/medium.mp4 +0 -0
  29. data/examples/support/videos/small.mp4 +0 -0
  30. data/examples/video/create_update_delete_spec.rb +73 -0
  31. data/lib/vzaar_api/abstract.rb +9 -0
  32. data/lib/vzaar_api/category.rb +39 -0
  33. data/lib/vzaar_api/encoding_preset.rb +19 -0
  34. data/lib/vzaar_api/ingest_recipe.rb +35 -0
  35. data/lib/vzaar_api/legacy_rendition.rb +11 -0
  36. data/lib/vzaar_api/lib/active_object.rb +92 -0
  37. data/lib/vzaar_api/lib/api.rb +54 -0
  38. data/lib/vzaar_api/lib/api_response.rb +61 -0
  39. data/lib/vzaar_api/lib/has_attributes.rb +49 -0
  40. data/lib/vzaar_api/lib/has_collection_builder.rb +17 -0
  41. data/lib/vzaar_api/lib/has_resource_url.rb +24 -0
  42. data/lib/vzaar_api/lib/paged_resource.rb +80 -0
  43. data/lib/vzaar_api/lib/will_paginate.rb +22 -0
  44. data/lib/vzaar_api/link_upload.rb +14 -0
  45. data/lib/vzaar_api/playlist.rb +29 -0
  46. data/lib/vzaar_api/rendition.rb +16 -0
  47. data/lib/vzaar_api/signature/abstract.rb +40 -0
  48. data/lib/vzaar_api/signature/factory.rb +39 -0
  49. data/lib/vzaar_api/signature/multipart.rb +23 -0
  50. data/lib/vzaar_api/signature/single.rb +17 -0
  51. data/lib/vzaar_api/strategy/video/create.rb +46 -0
  52. data/lib/vzaar_api/upload/s3.rb +90 -0
  53. data/lib/vzaar_api/upload/virtual_file.rb +14 -0
  54. data/lib/vzaar_api/version.rb +4 -0
  55. data/lib/vzaar_api/video.rb +38 -0
  56. data/lib/vzaar_api.rb +60 -0
  57. data/spec/fixtures/vcr_cassettes/categories/each_item.yml +363 -0
  58. data/spec/fixtures/vcr_cassettes/categories/find.yml +61 -0
  59. data/spec/fixtures/vcr_cassettes/categories/find_404.yml +49 -0
  60. data/spec/fixtures/vcr_cassettes/categories/paginate_first.yml +61 -0
  61. data/spec/fixtures/vcr_cassettes/categories/paginate_last.yml +119 -0
  62. data/spec/fixtures/vcr_cassettes/categories/paginate_next.yml +120 -0
  63. data/spec/fixtures/vcr_cassettes/categories/paginate_previous.yml +120 -0
  64. data/spec/fixtures/vcr_cassettes/categories/subtree.yml +127 -0
  65. data/spec/fixtures/vcr_cassettes/categories/subtree_paginate_first.yml +123 -0
  66. data/spec/fixtures/vcr_cassettes/categories/subtree_paginate_last.yml +185 -0
  67. data/spec/fixtures/vcr_cassettes/categories/subtree_paginate_next.yml +184 -0
  68. data/spec/fixtures/vcr_cassettes/categories/subtree_paginate_previous.yml +184 -0
  69. data/spec/fixtures/vcr_cassettes/encoding_presets/each_item.yml +299 -0
  70. data/spec/fixtures/vcr_cassettes/encoding_presets/find.yml +62 -0
  71. data/spec/fixtures/vcr_cassettes/encoding_presets/find_404.yml +51 -0
  72. data/spec/fixtures/vcr_cassettes/encoding_presets/paginate_first.yml +62 -0
  73. data/spec/fixtures/vcr_cassettes/encoding_presets/paginate_last.yml +121 -0
  74. data/spec/fixtures/vcr_cassettes/encoding_presets/paginate_next.yml +121 -0
  75. data/spec/fixtures/vcr_cassettes/encoding_presets/paginate_previous.yml +121 -0
  76. data/spec/fixtures/vcr_cassettes/ingest_recipes/create_200.yml +63 -0
  77. data/spec/fixtures/vcr_cassettes/ingest_recipes/create_422.yml +52 -0
  78. data/spec/fixtures/vcr_cassettes/ingest_recipes/delete_204.yml +166 -0
  79. data/spec/fixtures/vcr_cassettes/ingest_recipes/delete_422.yml +112 -0
  80. data/spec/fixtures/vcr_cassettes/ingest_recipes/each_item.yml +182 -0
  81. data/spec/fixtures/vcr_cassettes/ingest_recipes/find.yml +62 -0
  82. data/spec/fixtures/vcr_cassettes/ingest_recipes/find_404.yml +51 -0
  83. data/spec/fixtures/vcr_cassettes/ingest_recipes/paginate_first.yml +62 -0
  84. data/spec/fixtures/vcr_cassettes/ingest_recipes/paginate_last.yml +122 -0
  85. data/spec/fixtures/vcr_cassettes/ingest_recipes/paginate_next.yml +121 -0
  86. data/spec/fixtures/vcr_cassettes/ingest_recipes/paginate_previous.yml +122 -0
  87. data/spec/fixtures/vcr_cassettes/ingest_recipes/update_200.yml +242 -0
  88. data/spec/fixtures/vcr_cassettes/ingest_recipes/update_422.yml +113 -0
  89. data/spec/fixtures/vcr_cassettes/playlists/each_item.yml +607 -0
  90. data/spec/fixtures/vcr_cassettes/playlists/find.yml +66 -0
  91. data/spec/fixtures/vcr_cassettes/playlists/find_404.yml +51 -0
  92. data/spec/fixtures/vcr_cassettes/playlists/paginate_first.yml +74 -0
  93. data/spec/fixtures/vcr_cassettes/playlists/paginate_last.yml +146 -0
  94. data/spec/fixtures/vcr_cassettes/playlists/paginate_next.yml +145 -0
  95. data/spec/fixtures/vcr_cassettes/playlists/paginate_previous.yml +145 -0
  96. data/spec/fixtures/vcr_cassettes/signature/multipart_201.yml +62 -0
  97. data/spec/fixtures/vcr_cassettes/signature/multipart_422.yml +52 -0
  98. data/spec/fixtures/vcr_cassettes/signature/single_201.yml +62 -0
  99. data/spec/fixtures/vcr_cassettes/signature/single_422.yml +51 -0
  100. data/spec/fixtures/vcr_cassettes/upload/multipart_201.yml +279868 -0
  101. data/spec/fixtures/vcr_cassettes/upload/multipart_403.yml +116578 -0
  102. data/spec/fixtures/vcr_cassettes/upload/single_201.yml +23388 -0
  103. data/spec/fixtures/vcr_cassettes/upload/single_403.yml +23374 -0
  104. data/spec/fixtures/vcr_cassettes/videos/create/error.yml +51 -0
  105. data/spec/fixtures/vcr_cassettes/videos/create/guid_201.yml +65 -0
  106. data/spec/fixtures/vcr_cassettes/videos/create/guid_error.yml +52 -0
  107. data/spec/fixtures/vcr_cassettes/videos/create/link_201.yml +65 -0
  108. data/spec/fixtures/vcr_cassettes/videos/create/link_error.yml +51 -0
  109. data/spec/fixtures/vcr_cassettes/videos/create/path_201.yml +23509 -0
  110. data/spec/fixtures/vcr_cassettes/videos/delete_204.yml +168 -0
  111. data/spec/fixtures/vcr_cassettes/videos/find.yml +66 -0
  112. data/spec/fixtures/vcr_cassettes/videos/find_404.yml +51 -0
  113. data/spec/fixtures/vcr_cassettes/videos/paginate_first.yml +71 -0
  114. data/spec/fixtures/vcr_cassettes/videos/paginate_last.yml +137 -0
  115. data/spec/fixtures/vcr_cassettes/videos/paginate_next.yml +139 -0
  116. data/spec/fixtures/vcr_cassettes/videos/paginate_previous.yml +139 -0
  117. data/spec/spec_helper.rb +103 -0
  118. data/spec/support/files/video-1.0MB.mp4 +0 -0
  119. data/spec/support/files/video-12.0MB.mp4 +0 -0
  120. data/spec/support/files/video-4.9MB.mp4 +0 -0
  121. data/spec/support/files/video-5.0MB.mp4 +0 -0
  122. data/spec/support/helpers.rb +16 -0
  123. data/spec/vzaar_api/category_spec.rb +141 -0
  124. data/spec/vzaar_api/encoding_preset_spec.rb +92 -0
  125. data/spec/vzaar_api/ingest_recipe_spec.rb +197 -0
  126. data/spec/vzaar_api/lib/api_spec.rb +28 -0
  127. data/spec/vzaar_api/playlist_spec.rb +97 -0
  128. data/spec/vzaar_api/rendition_spec.rb +55 -0
  129. data/spec/vzaar_api/signature/factory_spec.rb +68 -0
  130. data/spec/vzaar_api/signature/multipart_spec.rb +81 -0
  131. data/spec/vzaar_api/signature/single_spec.rb +72 -0
  132. data/spec/vzaar_api/upload/s3_spec.rb +112 -0
  133. data/spec/vzaar_api/video_spec.rb +248 -0
  134. data/spec/vzaar_api/vzaar_api_spec.rb +18 -0
  135. data/spec/vzaar_api_helper.rb +19 -0
  136. data/vzaar.png +0 -0
  137. data/vzaar_api.gemspec +35 -0
  138. metadata +413 -0
@@ -0,0 +1,139 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://app.vzaar.localhost/api/v2/videos?per_page=3
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.8.2.4, ruby 2.3.1 (2016-04-26))
12
+ Accept:
13
+ - "*/*"
14
+ Date:
15
+ - Fri, 18 Nov 2016 16:12:10 GMT
16
+ X-Auth-Token:
17
+ - TUGXzNL17ypaougMYpR3
18
+ X-Client-Id:
19
+ - lair-tend72
20
+ Content-Type:
21
+ - application/json
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Server:
28
+ - nginx/1.10.1
29
+ Date:
30
+ - Fri, 18 Nov 2016 16:12:10 GMT
31
+ Content-Type:
32
+ - application/json
33
+ Content-Length:
34
+ - '3533'
35
+ Connection:
36
+ - keep-alive
37
+ X-RateLimit-Limit:
38
+ - '200'
39
+ X-RateLimit-Remaining:
40
+ - '199'
41
+ X-RateLimit-Reset:
42
+ - '1479485590'
43
+ X-RateLimit-Reset-In:
44
+ - 60 seconds
45
+ Cache-Control:
46
+ - no-store, must-revalidate, private, max-age=0
47
+ X-Request-Id:
48
+ - 54a4b44d-9207-4a64-aca5-88f662cb97bc
49
+ X-Runtime:
50
+ - '0.182878'
51
+ Set-Cookie:
52
+ - __profilin=p%3Dt; path=/
53
+ - __profilin=p%3Dt; path=/
54
+ - __profilin=p%3Dt; path=/
55
+ X-Miniprofiler-Ids:
56
+ - '["z08p6ost5ya9npxy3apa","yibtuiqnohudk1d26xvg","cpo3oiqmi683pkcaj816","dtxr2heeicch5rud7pjt","b4scoosnvmo0xvyqw8fy","58r4vfxumrhgue7kbsai","5dfv6js4ggxyc9qp8qwk","luelw09036g1c3l24a6i","racr2kqe0uft8glynfol","yfqme9j3k1haf6v4sm35"]'
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"data":[{"id":7574853,"title":"multipart","user_id":79357,"account_id":79357,"description":null,"duration":66.7,"created_at":"2016-11-11T11:36:26.000Z","updated_at":"2016-11-11T11:37:36.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574853/thumb","embed_code":"<iframe
60
+ id=\"vzvd-7574853\" name=\"vzvd-7574853\" title=\"video player\" class=\"video-player\"
61
+ type=\"text/html\" width=\"448\" height=\"278\" frameborder=\"0\" allowfullscreen
62
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574853/player\"></iframe>","categories":[],"renditions":[{"id":66,"width":416,"height":258,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":67,"width":480,"height":297,"bitrate":400,"framerate":"29.97","status":"finished"},{"id":68,"width":448,"height":278,"bitrate":900,"framerate":"25.0","status":"finished"},{"id":69,"width":1920,"height":1191,"bitrate":5442,"framerate":"29.97","status":"skipped"},{"id":70,"width":640,"height":397,"bitrate":800,"framerate":"29.97","status":"finished"}]},{"id":7574852,"title":"multipart","user_id":79357,"account_id":79357,"description":null,"duration":null,"created_at":"2016-11-10T12:56:31.000Z","updated_at":"2016-11-10T16:58:34.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574852/thumb","embed_code":"<iframe
63
+ id=\"vzvd-7574852\" name=\"vzvd-7574852\" title=\"video player\" class=\"video-player\"
64
+ type=\"text/html\" width=\"448\" height=\"278\" frameborder=\"0\" allowfullscreen
65
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574852/player\"></iframe>","categories":[],"renditions":[{"id":61,"width":480,"height":297,"bitrate":400,"framerate":"29.97","status":"finished"},{"id":62,"width":416,"height":258,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":63,"width":640,"height":397,"bitrate":800,"framerate":"29.97","status":"finished"},{"id":64,"width":448,"height":278,"bitrate":900,"framerate":"25.0","status":"finished"},{"id":65,"width":1920,"height":1191,"bitrate":5442,"framerate":"29.97","status":"skipped"}]},{"id":7574851,"title":"multipart","user_id":79357,"account_id":79357,"description":null,"duration":null,"created_at":"2016-11-09T17:16:06.000Z","updated_at":"2016-11-09T17:17:06.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574851/thumb","embed_code":"<iframe
66
+ id=\"vzvd-7574851\" name=\"vzvd-7574851\" title=\"video player\" class=\"video-player\"
67
+ type=\"text/html\" width=\"448\" height=\"278\" frameborder=\"0\" allowfullscreen
68
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574851/player\"></iframe>","categories":[],"renditions":[{"id":56,"width":416,"height":258,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":57,"width":480,"height":297,"bitrate":400,"framerate":"29.97","status":"finished"},{"id":58,"width":640,"height":397,"bitrate":800,"framerate":"29.97","status":"finished"},{"id":59,"width":1920,"height":1191,"bitrate":5442,"framerate":"29.97","status":"skipped"},{"id":60,"width":448,"height":278,"bitrate":900,"framerate":"25.0","status":"finished"}]}],"meta":{"total_count":212,"links":{"first":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=1&per_page=3&state=ready","next":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=2&per_page=3&state=ready","previous":null,"last":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=71&per_page=3&state=ready"}}}'
69
+ http_version:
70
+ recorded_at: Fri, 18 Nov 2016 16:12:10 GMT
71
+ - request:
72
+ method: get
73
+ uri: https://app.vzaar.localhost/api/v2/videos
74
+ body:
75
+ encoding: UTF-8
76
+ string: ''
77
+ headers:
78
+ User-Agent:
79
+ - HTTPClient/1.0 (2.8.2.4, ruby 2.3.1 (2016-04-26))
80
+ Accept:
81
+ - "*/*"
82
+ Date:
83
+ - Fri, 18 Nov 2016 16:12:10 GMT
84
+ X-Auth-Token:
85
+ - TUGXzNL17ypaougMYpR3
86
+ X-Client-Id:
87
+ - lair-tend72
88
+ Content-Type:
89
+ - application/json
90
+ response:
91
+ status:
92
+ code: 200
93
+ message: OK
94
+ headers:
95
+ Server:
96
+ - nginx/1.10.1
97
+ Date:
98
+ - Fri, 18 Nov 2016 16:12:10 GMT
99
+ Content-Type:
100
+ - application/json
101
+ Content-Length:
102
+ - '3610'
103
+ Connection:
104
+ - keep-alive
105
+ X-RateLimit-Limit:
106
+ - '200'
107
+ X-RateLimit-Remaining:
108
+ - '198'
109
+ X-RateLimit-Reset:
110
+ - '1479485590'
111
+ X-RateLimit-Reset-In:
112
+ - 60 seconds
113
+ Cache-Control:
114
+ - no-store, must-revalidate, private, max-age=0
115
+ X-Request-Id:
116
+ - 9d24e54f-86dd-4f6a-843e-ec4e8b4a675e
117
+ X-Runtime:
118
+ - '0.091003'
119
+ Set-Cookie:
120
+ - __profilin=p%3Dt; path=/
121
+ - __profilin=p%3Dt; path=/
122
+ - __profilin=p%3Dt; path=/
123
+ X-Miniprofiler-Ids:
124
+ - '["9r9g0m5v62o4oykpkba2","yibtuiqnohudk1d26xvg","cpo3oiqmi683pkcaj816","dtxr2heeicch5rud7pjt","b4scoosnvmo0xvyqw8fy","58r4vfxumrhgue7kbsai","5dfv6js4ggxyc9qp8qwk","luelw09036g1c3l24a6i","racr2kqe0uft8glynfol","yfqme9j3k1haf6v4sm35"]'
125
+ body:
126
+ encoding: UTF-8
127
+ string: '{"data":[{"id":7574850,"title":"multipart","user_id":79357,"account_id":79357,"description":null,"duration":null,"created_at":"2016-11-09T17:13:46.000Z","updated_at":"2016-11-09T17:14:46.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574850/thumb","embed_code":"<iframe
128
+ id=\"vzvd-7574850\" name=\"vzvd-7574850\" title=\"video player\" class=\"video-player\"
129
+ type=\"text/html\" width=\"448\" height=\"278\" frameborder=\"0\" allowfullscreen
130
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574850/player\"></iframe>","renditions":[{"id":51,"width":480,"height":297,"bitrate":400,"framerate":"29.97","status":"finished"},{"id":52,"width":448,"height":278,"bitrate":900,"framerate":"25.0","status":"finished"},{"id":53,"width":416,"height":258,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":54,"width":1920,"height":1191,"bitrate":5442,"framerate":"29.97","status":"skipped"},{"id":55,"width":640,"height":397,"bitrate":800,"framerate":"29.97","status":"finished"}]},{"id":7574849,"title":"link","user_id":79357,"account_id":79357,"description":null,"duration":null,"created_at":"2016-11-09T16:13:51.000Z","updated_at":"2016-11-09T16:19:26.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574849/thumb","embed_code":"<iframe
131
+ id=\"vzvd-7574849\" name=\"vzvd-7574849\" title=\"video player\" class=\"video-player\"
132
+ type=\"text/html\" width=\"1280\" height=\"720\" frameborder=\"0\" allowfullscreen
133
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574849/player\"></iframe>","renditions":[{"id":46,"width":480,"height":270,"bitrate":400,"framerate":"29.97","status":"finished"},{"id":47,"width":640,"height":360,"bitrate":800,"framerate":"29.97","status":"finished"},{"id":48,"width":416,"height":234,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":49,"width":1920,"height":1080,"bitrate":5442,"framerate":"29.97","status":"skipped"},{"id":50,"width":1280,"height":720,"bitrate":1709,"framerate":"30.0","status":"finished"}]},{"id":7574848,"title":"multipart","user_id":79357,"account_id":79357,"description":null,"duration":null,"created_at":"2016-11-09T16:13:51.000Z","updated_at":"2016-11-09T16:14:41.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574848/thumb","embed_code":"<iframe
134
+ id=\"vzvd-7574848\" name=\"vzvd-7574848\" title=\"video player\" class=\"video-player\"
135
+ type=\"text/html\" width=\"448\" height=\"278\" frameborder=\"0\" allowfullscreen
136
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574848/player\"></iframe>","renditions":[{"id":41,"width":640,"height":397,"bitrate":800,"framerate":"29.97","status":"finished"},{"id":42,"width":480,"height":297,"bitrate":400,"framerate":"29.97","status":"finished"},{"id":43,"width":1920,"height":1191,"bitrate":5442,"framerate":"29.97","status":"skipped"},{"id":44,"width":416,"height":258,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":45,"width":448,"height":278,"bitrate":900,"framerate":"25.0","status":"finished"}]}],"meta":{"total_count":212,"links":{"first":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=1&per_page=3&state=ready","next":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=3&per_page=3&state=ready","previous":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=1&per_page=3&state=ready","last":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=71&per_page=3&state=ready"}}}'
137
+ http_version:
138
+ recorded_at: Fri, 18 Nov 2016 16:12:10 GMT
139
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,139 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://app.vzaar.localhost/api/v2/videos?page=4&per_page=3
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.8.2.4, ruby 2.3.1 (2016-04-26))
12
+ Accept:
13
+ - "*/*"
14
+ Date:
15
+ - Fri, 18 Nov 2016 16:12:48 GMT
16
+ X-Auth-Token:
17
+ - TUGXzNL17ypaougMYpR3
18
+ X-Client-Id:
19
+ - lair-tend72
20
+ Content-Type:
21
+ - application/json
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Server:
28
+ - nginx/1.10.1
29
+ Date:
30
+ - Fri, 18 Nov 2016 16:12:48 GMT
31
+ Content-Type:
32
+ - application/json
33
+ Content-Length:
34
+ - '3371'
35
+ Connection:
36
+ - keep-alive
37
+ X-RateLimit-Limit:
38
+ - '200'
39
+ X-RateLimit-Remaining:
40
+ - '195'
41
+ X-RateLimit-Reset:
42
+ - '1479485628'
43
+ X-RateLimit-Reset-In:
44
+ - 60 seconds
45
+ Cache-Control:
46
+ - no-store, must-revalidate, private, max-age=0
47
+ X-Request-Id:
48
+ - 8e5fad16-084b-48a1-ae07-a336e5553078
49
+ X-Runtime:
50
+ - '0.087682'
51
+ Set-Cookie:
52
+ - __profilin=p%3Dt; path=/
53
+ - __profilin=p%3Dt; path=/
54
+ - __profilin=p%3Dt; path=/
55
+ X-Miniprofiler-Ids:
56
+ - '["a2y8w25dibn5drdudcnr","yibtuiqnohudk1d26xvg","cpo3oiqmi683pkcaj816","dtxr2heeicch5rud7pjt","b4scoosnvmo0xvyqw8fy","58r4vfxumrhgue7kbsai","5dfv6js4ggxyc9qp8qwk","luelw09036g1c3l24a6i","racr2kqe0uft8glynfol","yfqme9j3k1haf6v4sm35"]'
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"data":[{"id":7574843,"title":"multipart","user_id":79357,"account_id":79357,"description":null,"duration":null,"created_at":"2016-11-09T14:00:16.000Z","updated_at":"2016-11-09T14:00:25.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574843/thumb","embed_code":"<iframe
60
+ id=\"vzvd-7574843\" name=\"vzvd-7574843\" title=\"video player\" class=\"video-player\"
61
+ type=\"text/html\" width=\"448\" height=\"278\" frameborder=\"0\" allowfullscreen
62
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574843/player\"></iframe>","categories":[],"renditions":[{"id":21,"width":416,"height":258,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":22,"width":480,"height":297,"bitrate":400,"framerate":"29.97","status":"finished"},{"id":23,"width":448,"height":278,"bitrate":900,"framerate":"25.0","status":"finished"},{"id":24,"width":1920,"height":1191,"bitrate":5442,"framerate":"29.97","status":"skipped"},{"id":25,"width":640,"height":397,"bitrate":800,"framerate":"29.97","status":"finished"}]},{"id":7574842,"title":"single-part","user_id":79357,"account_id":79357,"description":null,"duration":null,"created_at":"2016-11-09T14:00:11.000Z","updated_at":"2016-11-09T14:00:59.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574842/thumb","embed_code":"<iframe
63
+ id=\"vzvd-7574842\" name=\"vzvd-7574842\" title=\"video player\" class=\"video-player\"
64
+ type=\"text/html\" width=\"640\" height=\"480\" frameborder=\"0\" allowfullscreen
65
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574842/player\"></iframe>","categories":[],"renditions":[{"id":16,"width":480,"height":360,"bitrate":400,"framerate":"29.97","status":"skipped"},{"id":17,"width":640,"height":480,"bitrate":800,"framerate":"29.97","status":"skipped"},{"id":18,"width":1920,"height":1440,"bitrate":5442,"framerate":"29.97","status":"skipped"},{"id":19,"width":416,"height":312,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":20,"width":640,"height":480,"bitrate":307,"framerate":"10.0","status":"finished"}]},{"id":7574840,"title":"ej-big.mp4","user_id":79357,"account_id":79357,"description":null,"duration":66.73,"created_at":"2016-11-09T11:51:38.000Z","updated_at":"2016-11-09T11:53:46.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574840/thumb","embed_code":"<iframe
66
+ id=\"vzvd-7574840\" name=\"vzvd-7574840\" title=\"video player\" class=\"video-player\"
67
+ type=\"text/html\" width=\"448\" height=\"276\" frameborder=\"0\" allowfullscreen
68
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574840/player\"></iframe>","categories":[],"renditions":[],"legacy_renditions":[{"id":10567124,"type":"standard","width":448,"height":278,"bitrate":512,"status":"Finished"},{"id":10567125,"type":"hd","width":null,"height":null,"bitrate":768,"status":"Error"}]}],"meta":{"total_count":212,"links":{"first":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=1&per_page=3&state=ready","next":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=5&per_page=3&state=ready","previous":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=3&per_page=3&state=ready","last":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=71&per_page=3&state=ready"}}}'
69
+ http_version:
70
+ recorded_at: Fri, 18 Nov 2016 16:12:48 GMT
71
+ - request:
72
+ method: get
73
+ uri: https://app.vzaar.localhost/api/v2/videos
74
+ body:
75
+ encoding: UTF-8
76
+ string: ''
77
+ headers:
78
+ User-Agent:
79
+ - HTTPClient/1.0 (2.8.2.4, ruby 2.3.1 (2016-04-26))
80
+ Accept:
81
+ - "*/*"
82
+ Date:
83
+ - Fri, 18 Nov 2016 16:12:48 GMT
84
+ X-Auth-Token:
85
+ - TUGXzNL17ypaougMYpR3
86
+ X-Client-Id:
87
+ - lair-tend72
88
+ Content-Type:
89
+ - application/json
90
+ response:
91
+ status:
92
+ code: 200
93
+ message: OK
94
+ headers:
95
+ Server:
96
+ - nginx/1.10.1
97
+ Date:
98
+ - Fri, 18 Nov 2016 16:12:48 GMT
99
+ Content-Type:
100
+ - application/json
101
+ Content-Length:
102
+ - '3610'
103
+ Connection:
104
+ - keep-alive
105
+ X-RateLimit-Limit:
106
+ - '200'
107
+ X-RateLimit-Remaining:
108
+ - '194'
109
+ X-RateLimit-Reset:
110
+ - '1479485628'
111
+ X-RateLimit-Reset-In:
112
+ - 60 seconds
113
+ Cache-Control:
114
+ - no-store, must-revalidate, private, max-age=0
115
+ X-Request-Id:
116
+ - abbd0759-c6d5-4af0-9478-32d9acae7593
117
+ X-Runtime:
118
+ - '0.090951'
119
+ Set-Cookie:
120
+ - __profilin=p%3Dt; path=/
121
+ - __profilin=p%3Dt; path=/
122
+ - __profilin=p%3Dt; path=/
123
+ X-Miniprofiler-Ids:
124
+ - '["gf7yytzhwecdjse4smr8","yibtuiqnohudk1d26xvg","cpo3oiqmi683pkcaj816","dtxr2heeicch5rud7pjt","b4scoosnvmo0xvyqw8fy","58r4vfxumrhgue7kbsai","5dfv6js4ggxyc9qp8qwk","luelw09036g1c3l24a6i","racr2kqe0uft8glynfol","yfqme9j3k1haf6v4sm35"]'
125
+ body:
126
+ encoding: UTF-8
127
+ string: '{"data":[{"id":7574847,"title":"single-part","user_id":79357,"account_id":79357,"description":null,"duration":null,"created_at":"2016-11-09T16:13:44.000Z","updated_at":"2016-11-09T16:18:23.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574847/thumb","embed_code":"<iframe
128
+ id=\"vzvd-7574847\" name=\"vzvd-7574847\" title=\"video player\" class=\"video-player\"
129
+ type=\"text/html\" width=\"640\" height=\"480\" frameborder=\"0\" allowfullscreen
130
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574847/player\"></iframe>","renditions":[{"id":36,"width":640,"height":480,"bitrate":800,"framerate":"29.97","status":"skipped"},{"id":37,"width":416,"height":312,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":38,"width":1920,"height":1440,"bitrate":5442,"framerate":"29.97","status":"skipped"},{"id":39,"width":480,"height":360,"bitrate":400,"framerate":"29.97","status":"skipped"},{"id":40,"width":640,"height":480,"bitrate":307,"framerate":"10.0","status":"finished"}]},{"id":7574845,"title":"multipart","user_id":79357,"account_id":79357,"description":null,"duration":null,"created_at":"2016-11-09T14:11:23.000Z","updated_at":"2016-11-09T14:16:27.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574845/thumb","embed_code":"<iframe
131
+ id=\"vzvd-7574845\" name=\"vzvd-7574845\" title=\"video player\" class=\"video-player\"
132
+ type=\"text/html\" width=\"448\" height=\"278\" frameborder=\"0\" allowfullscreen
133
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574845/player\"></iframe>","renditions":[{"id":31,"width":480,"height":297,"bitrate":400,"framerate":"29.97","status":"finished"},{"id":32,"width":640,"height":397,"bitrate":800,"framerate":"29.97","status":"finished"},{"id":33,"width":416,"height":258,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":34,"width":1920,"height":1191,"bitrate":5442,"framerate":"29.97","status":"skipped"},{"id":35,"width":448,"height":278,"bitrate":900,"framerate":"25.0","status":"finished"}]},{"id":7574844,"title":"link","user_id":79357,"account_id":79357,"description":null,"duration":null,"created_at":"2016-11-09T14:00:16.000Z","updated_at":"2016-11-09T14:01:22.000Z","private":false,"seo_url":null,"url":null,"thumbnail_url":"https://view.vzaar.localhost/7574844/thumb","embed_code":"<iframe
134
+ id=\"vzvd-7574844\" name=\"vzvd-7574844\" title=\"video player\" class=\"video-player\"
135
+ type=\"text/html\" width=\"1280\" height=\"720\" frameborder=\"0\" allowfullscreen
136
+ allowTransparency=\"true\" mozallowfullscreen webkitAllowFullScreen src=\"//view.vzaar.localhost/7574844/player\"></iframe>","renditions":[{"id":26,"width":1920,"height":1080,"bitrate":5442,"framerate":"29.97","status":"skipped"},{"id":27,"width":480,"height":270,"bitrate":400,"framerate":"29.97","status":"finished"},{"id":28,"width":416,"height":234,"bitrate":200,"framerate":"12.0","status":"finished"},{"id":29,"width":640,"height":360,"bitrate":800,"framerate":"29.97","status":"finished"},{"id":30,"width":1280,"height":720,"bitrate":1709,"framerate":"30.0","status":"finished"}]}],"meta":{"total_count":212,"links":{"first":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=1&per_page=3&state=ready","next":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=4&per_page=3&state=ready","previous":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=2&per_page=3&state=ready","last":"https://app.vzaar.localhost/api/v2/videos?order=asc&page=71&per_page=3&state=ready"}}}'
137
+ http_version:
138
+ recorded_at: Fri, 18 Nov 2016 16:12:48 GMT
139
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,103 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
44
+ # have no way to turn it off -- the option exists only for backwards
45
+ # compatibility in RSpec 3). It causes shared context metadata to be
46
+ # inherited by the metadata hash of host groups and examples, rather than
47
+ # triggering implicit auto-inclusion in groups with matching metadata.
48
+ config.shared_context_metadata_behavior = :apply_to_host_groups
49
+
50
+ # The settings below are suggested to provide a good initial experience
51
+ # with RSpec, but feel free to customize to your heart's content.
52
+ =begin
53
+ # This allows you to limit a spec run to individual examples or groups
54
+ # you care about by tagging them with `:focus` metadata. When nothing
55
+ # is tagged with `:focus`, all examples get run. RSpec also provides
56
+ # aliases for `it`, `describe`, and `context` that include `:focus`
57
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
58
+ config.filter_run_when_matching :focus
59
+
60
+ # Allows RSpec to persist some state between runs in order to support
61
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
62
+ # you configure your source control system to ignore this file.
63
+ config.example_status_persistence_file_path = "spec/examples.txt"
64
+
65
+ # Limits the available syntax to the non-monkey patched syntax that is
66
+ # recommended. For more details, see:
67
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
68
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
69
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
70
+ config.disable_monkey_patching!
71
+
72
+ # This setting enables warnings. It's recommended, but in some cases may
73
+ # be too noisy due to issues in dependencies.
74
+ config.warnings = true
75
+
76
+ # Many RSpec users commonly either run the entire suite or an individual
77
+ # file, and it's useful to allow more verbose output when running an
78
+ # individual spec file.
79
+ if config.files_to_run.one?
80
+ # Use the documentation formatter for detailed output,
81
+ # unless a formatter has already been configured
82
+ # (e.g. via a command-line flag).
83
+ config.default_formatter = 'doc'
84
+ end
85
+
86
+ # Print the 10 slowest examples and example groups at the
87
+ # end of the spec run, to help surface which specs are running
88
+ # particularly slow.
89
+ config.profile_examples = 10
90
+
91
+ # Run specs in random order to surface order dependencies. If you find an
92
+ # order dependency and want to debug it, you can fix the order by providing
93
+ # the seed, which is printed after each run.
94
+ # --seed 1234
95
+ config.order = :random
96
+
97
+ # Seed global randomization in this process using the `--seed` CLI option.
98
+ # Setting this allows you to use `--seed` to deterministically reproduce
99
+ # test failures related to randomization by passing the same `--seed` value
100
+ # as the one that triggered the failure.
101
+ Kernel.srand config.seed
102
+ =end
103
+ end
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,16 @@
1
+ module Helpers
2
+
3
+ def api_envs
4
+ @api_envs = begin
5
+ env = ENV["API_ENV"] || "development"
6
+ YAML.load_file("api_envs.yml")[env]
7
+ end
8
+ end
9
+
10
+ def setup_auth!
11
+ VzaarApi.auth_token = 'TUGXzNL17ypaougMYpR3'
12
+ VzaarApi.client_id = 'lair-tend72'
13
+ VzaarApi.hostname = 'app.vzaar.localhost'
14
+ end
15
+
16
+ end
@@ -0,0 +1,141 @@
1
+ module VzaarApi
2
+ describe Category do
3
+
4
+ before do
5
+ setup_auth!
6
+ end
7
+
8
+ describe '.find' do
9
+ context 'when the category can be found' do
10
+ it 'finds the category' do
11
+ VCR.use_cassette('categories/find') do
12
+ category = described_class.find(334)
13
+ expect(category.id).to eq 334
14
+ expect(category.account_id).to eq 79357
15
+ expect(category.user_id).to eq 79357
16
+ expect(category.name).to eq 'Indoors'
17
+ expect(category.description).to eq 'All indoor videos'
18
+ expect(category.parent_id).to eq 331
19
+ expect(category.depth).to eq 1
20
+ expect(category.node_children_count).to eq 2
21
+ expect(category.tree_children_count).to eq 2
22
+ expect(category.node_video_count).to eq 2
23
+ expect(category.tree_video_count).to eq 3
24
+ expect(category.created_at).to eq '2015-04-07T09:39:06.000Z'
25
+ expect(category.updated_at).to eq '2016-10-18T16:29:11.000Z'
26
+ end
27
+ end
28
+ end
29
+
30
+ context 'when the category cannot be found' do
31
+ it 'raises an error' do
32
+ VCR.use_cassette('categories/find_404') do
33
+ expect { described_class.find(-1) }.
34
+ to raise_error(Error, 'Not found: Resource cannot be found')
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ describe '.each_item' do
41
+ it 'loads the category collection' do
42
+ VCR.use_cassette('categories/each_item') do
43
+ enum = described_class.each_item(per_page: 2)
44
+ ids = enum.map { |category| category.id }
45
+ expect(ids).to match_array [331, 332, 333, 334, 335, 336, 2232, 2233, 2234, 2235, 2236, 2237]
46
+ end
47
+ end
48
+ end
49
+
50
+ describe '.paginate' do
51
+ it 'loads the category collection' do
52
+ VCR.use_cassette('categories/paginate_first') do
53
+ pager = described_class.paginate(per_page: 3)
54
+ pager.first
55
+ ids = pager.collection.map { |category| category.id }
56
+ expect(ids).to match_array [331, 332, 333]
57
+ end
58
+ end
59
+
60
+ it 'loads the category collection' do
61
+ VCR.use_cassette('categories/paginate_next') do
62
+ pager = described_class.paginate(per_page: 3)
63
+ pager.next
64
+ ids = pager.collection.map { |category| category.id }
65
+ expect(ids).to match_array [334, 335, 336]
66
+ end
67
+ end
68
+
69
+ it 'loads the category collection' do
70
+ VCR.use_cassette('categories/paginate_last') do
71
+ pager = described_class.paginate(per_page: 3)
72
+ pager.last
73
+ ids = pager.collection.map { |category| category.id }
74
+ expect(ids).to match_array [2235, 2236, 2237]
75
+ end
76
+ end
77
+
78
+ it 'loads the category collection' do
79
+ VCR.use_cassette('categories/paginate_previous') do
80
+ pager = described_class.paginate(page: 4, per_page: 3)
81
+ pager.previous
82
+ ids = pager.collection.map { |category| category.id }
83
+ expect(ids).to match_array [2232, 2233, 2234]
84
+ end
85
+ end
86
+ end
87
+
88
+ describe '#subtree' do
89
+ it 'loads the category subtree' do
90
+ VCR.use_cassette('categories/subtree') do
91
+ category = described_class.find(331)
92
+ pager = category.subtree
93
+ pager.first
94
+ ids = pager.collection.map { |category| category.id }
95
+ expect(ids).to match_array [331, 333, 334, 2233, 2234, 2235]
96
+ end
97
+ end
98
+
99
+ it 'loads the category subtree' do
100
+ VCR.use_cassette('categories/subtree_paginate_first') do
101
+ category = described_class.find(331)
102
+ pager = category.subtree(per_page: 2)
103
+ pager.first
104
+ ids = pager.collection.map { |category| category.id }
105
+ expect(ids).to match_array [331, 333]
106
+ end
107
+ end
108
+
109
+ it 'loads the category subtree' do
110
+ VCR.use_cassette('categories/subtree_paginate_next') do
111
+ category = described_class.find(331)
112
+ pager = category.subtree(per_page: 2)
113
+ pager.next
114
+ ids = pager.collection.map { |category| category.id }
115
+ expect(ids).to match_array [334, 2233]
116
+ end
117
+ end
118
+
119
+ it 'loads the category subtree' do
120
+ VCR.use_cassette('categories/subtree_paginate_previous') do
121
+ category = described_class.find(331)
122
+ pager = category.subtree(per_page: 2, page: 2)
123
+ pager.previous
124
+ ids = pager.collection.map { |category| category.id }
125
+ expect(ids).to match_array [331, 333]
126
+ end
127
+ end
128
+
129
+ it 'loads the category subtree' do
130
+ VCR.use_cassette('categories/subtree_paginate_last') do
131
+ category = described_class.find(331)
132
+ pager = category.subtree(per_page: 2, page: 2)
133
+ pager.last
134
+ ids = pager.collection.map { |category| category.id }
135
+ expect(ids).to match_array [2234, 2235]
136
+ end
137
+ end
138
+ end
139
+
140
+ end
141
+ end