uiza 1.0.0

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 (48) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +535 -0
  3. data/.rubocop_disable.yml +78 -0
  4. data/.rubocop_enable.yml +786 -0
  5. data/CHANGELOG.md +41 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/CONTRIBUTORS.txt +3 -0
  8. data/Gemfile +6 -0
  9. data/Gemfile.lock +65 -0
  10. data/History.txt +1 -0
  11. data/LICENSE.txt +21 -0
  12. data/PULL_REQUEST_TEMPLATE.md +44 -0
  13. data/README.md +179 -0
  14. data/Rakefile +6 -0
  15. data/bin/console +14 -0
  16. data/bin/setup +8 -0
  17. data/doc/ANALYTIC.md +5 -0
  18. data/doc/CALLBACK.md +4 -0
  19. data/doc/CATEGORY.md +282 -0
  20. data/doc/EMBED_METADATA.md +4 -0
  21. data/doc/ENTITY.md +466 -0
  22. data/doc/ERRORS_CODE.md +60 -0
  23. data/doc/LIVE_STREAMING.md +6 -0
  24. data/doc/STORAGE.md +189 -0
  25. data/lib/uiza.rb +34 -0
  26. data/lib/uiza/api_operation/add.rb +16 -0
  27. data/lib/uiza/api_operation/create.rb +16 -0
  28. data/lib/uiza/api_operation/delete.rb +15 -0
  29. data/lib/uiza/api_operation/list.rb +14 -0
  30. data/lib/uiza/api_operation/remove.rb +15 -0
  31. data/lib/uiza/api_operation/retrieve.rb +15 -0
  32. data/lib/uiza/api_operation/update.rb +16 -0
  33. data/lib/uiza/category.rb +42 -0
  34. data/lib/uiza/entity.rb +68 -0
  35. data/lib/uiza/error/bad_request_error.rb +8 -0
  36. data/lib/uiza/error/client_error.rb +8 -0
  37. data/lib/uiza/error/internal_server_error.rb +8 -0
  38. data/lib/uiza/error/not_found_error.rb +8 -0
  39. data/lib/uiza/error/server_error.rb +8 -0
  40. data/lib/uiza/error/service_unavailable_error.rb +8 -0
  41. data/lib/uiza/error/uiza_error.rb +18 -0
  42. data/lib/uiza/error/unauthorized_error.rb +8 -0
  43. data/lib/uiza/error/unprocessable_error.rb +8 -0
  44. data/lib/uiza/storage.rb +17 -0
  45. data/lib/uiza/uiza_client.rb +74 -0
  46. data/lib/uiza/version.rb +3 -0
  47. data/uiza.gemspec +36 -0
  48. metadata +134 -0
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 - 2019-02-21
4
+ [#53](https://github.com/uizaio/api-wrapper-ruby/pull/53) Release Sprint 2
5
+ 1. Add APIOperation
6
+ - `Uiza::APIOperation::Add`
7
+ - `Uiza::APIOperation::Remove`
8
+
9
+ 2. Remove APIResource
10
+
11
+ 3. Add Storage
12
+
13
+ 4. Add Category
14
+
15
+ ## 0.1.0 - 2019-02-18
16
+ [#39](https://github.com/uizaio/api-wrapper-ruby/pull/39) Release Sprint 1
17
+ 1. Add APIOperation
18
+ - `Uiza::APIOperation::Create`
19
+ - `Uiza::APIOperation::Retrieve`
20
+ - `Uiza::APIOperation::List`
21
+ - `Uiza::APIOperation::Update`
22
+ - `Uiza::APIOperation::Delete`
23
+
24
+ 2. Add APIResource
25
+ - `Uiza::APIResource::EntityResource`
26
+
27
+ 3. Add Error
28
+ - `Uiza::Error::UizaError`
29
+ - `Uiza::Error::BadRequestError`
30
+ - `Uiza::Error::ClientError`
31
+ - `Uiza::Error::InternalServerError`
32
+ - `Uiza::Error::NotFoundError`
33
+ - `Uiza::Error::ServerError`
34
+ - `Uiza::Error::ServiceUnavailableError`
35
+ - `Uiza::Error::UnauthorizedError`
36
+ - `Uiza::Error::UnprocessableError`
37
+
38
+ 4. Add Entity
39
+
40
+ ## 0.1.0 - 2019-02-12
41
+ [#1](https://github.com/uizaio/api-wrapper-ruby/pull/1) Init project
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at tanthanhcr95@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,3 @@
1
+ Le Tan Thanh <le.tan.thanh@framgia.com>
2
+ Nguyen Thi Dieu <nguyen.thi.dieu@framgia.com>
3
+ Nguyen Tien Trung <nguyen.tien.trung@framgia.com>
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rubocop"
4
+ gem "webmock"
5
+
6
+ gemspec
@@ -0,0 +1,65 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ uiza (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.6.0)
10
+ public_suffix (>= 2.0.2, < 4.0)
11
+ ast (2.4.0)
12
+ crack (0.4.3)
13
+ safe_yaml (~> 1.0.0)
14
+ diff-lcs (1.3)
15
+ hashdiff (0.3.8)
16
+ jaro_winkler (1.5.2)
17
+ parallel (1.13.0)
18
+ parser (2.6.0.0)
19
+ ast (~> 2.4.0)
20
+ powerpack (0.1.2)
21
+ public_suffix (3.0.3)
22
+ rainbow (3.0.0)
23
+ rake (10.5.0)
24
+ rspec (3.8.0)
25
+ rspec-core (~> 3.8.0)
26
+ rspec-expectations (~> 3.8.0)
27
+ rspec-mocks (~> 3.8.0)
28
+ rspec-core (3.8.0)
29
+ rspec-support (~> 3.8.0)
30
+ rspec-expectations (3.8.2)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.8.0)
33
+ rspec-mocks (3.8.0)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.8.0)
36
+ rspec-support (3.8.0)
37
+ rubocop (0.64.0)
38
+ jaro_winkler (~> 1.5.1)
39
+ parallel (~> 1.10)
40
+ parser (>= 2.5, != 2.5.1.1)
41
+ powerpack (~> 0.1)
42
+ rainbow (>= 2.2.2, < 4.0)
43
+ ruby-progressbar (~> 1.7)
44
+ unicode-display_width (~> 1.4.0)
45
+ ruby-progressbar (1.10.0)
46
+ safe_yaml (1.0.4)
47
+ unicode-display_width (1.4.1)
48
+ webmock (3.5.1)
49
+ addressable (>= 2.3.6)
50
+ crack (>= 0.3.2)
51
+ hashdiff
52
+
53
+ PLATFORMS
54
+ ruby
55
+
56
+ DEPENDENCIES
57
+ bundler (~> 2.0)
58
+ rake (~> 10.0)
59
+ rspec (~> 3.0)
60
+ rubocop
61
+ uiza!
62
+ webmock
63
+
64
+ BUNDLED WITH
65
+ 2.0.1
@@ -0,0 +1 @@
1
+ History.txt has been converted to a formal changelog. Please see CHANGELOG.md.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Uiza (https://uiza.io/)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,44 @@
1
+ ## Related Tickets
2
+
3
+ - [#TicketID](https://dev.framgia.com/issues/xxx)
4
+
5
+ ## What's this PR do ?
6
+
7
+ - [x] Implement function A
8
+ - [x] Fix bugs on function B
9
+
10
+ ## Library
11
+ *(List gem, library third party add new include version)*
12
+
13
+ - Gem devise v1.2.0
14
+ - Library: google-analysis.js
15
+
16
+ ## Impacted Areas in Application
17
+ *(List features, api, models or services that this PR will affect)*
18
+
19
+ - foo/bar
20
+ - bar/baz
21
+
22
+ ## Performance
23
+
24
+ - [ ] Resolved n + 1 query
25
+ - [ ] Run explain query already
26
+ - [ ] Time run rake task : 1000 ms
27
+
28
+ ## Checklist
29
+
30
+ - [ ] It was tested in local success?
31
+ - [ ] Fill link PR into ticket and the opposite
32
+ - [ ] Note reason, scope of influence, solution into ticket
33
+ - [ ] Validate UI/Model/API
34
+
35
+ ## Deploy Notes
36
+ *(List rake task command, environment variable need config after deploy)*
37
+
38
+ ```sh
39
+ rake course:import
40
+ export ENVIRONMENT_VARIABLE = "abcxyz"
41
+ ```
42
+
43
+ ## Notes
44
+ *(Other notes)*
@@ -0,0 +1,179 @@
1
+ # Uiza
2
+
3
+ ## Introduction
4
+ This is documents the public API for Uiza version 3.0.
5
+
6
+ The Uiza API is organized around RESTful standard.
7
+ Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors.
8
+ JSON is returned by all API responses, including errors, although our API libraries convert responses to appropriate language-specific objects.
9
+
10
+ All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
11
+
12
+ ## Authentication
13
+ In order, to use the Uiza, you should follow these steps:
14
+
15
+ * **Step 1:** Having an active Uiza account. (If you don't have, please get [here](https://id.uiza.io/))
16
+ * **Step 2:** Once you have an Uiza account, you can get a Token to call the APIs.
17
+
18
+ This Token will have right & permission related with your account.
19
+
20
+
21
+ ## Installation
22
+ Add this line to your application's Gemfile:
23
+
24
+ ```ruby
25
+ gem "uiza"
26
+ ```
27
+
28
+ And then execute:
29
+
30
+ ```ruby
31
+ $ bundle
32
+ ```
33
+
34
+ Or install it yourself as:
35
+
36
+ ```ruby
37
+ $ gem install uiza
38
+ ```
39
+
40
+ ### Requirements
41
+ * Ruby 2.0+.
42
+
43
+ ## Usage
44
+ The library needs to be configured with your account's `workspace_api_domain` and `authorization` (API key).\
45
+ Set `Uiza.workspace_api_domain` and `Uiza.authorization` with your values:
46
+
47
+ See details [here](https://docs.uiza.io/#authentication).
48
+
49
+ ## Ruby
50
+ ```ruby
51
+ require "uiza"
52
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
53
+ Uiza.authorization = "your-authorization"
54
+ ```
55
+
56
+ ## ROR
57
+ Create file `your-app/config/initializers/uiza.rb`
58
+
59
+ ```ruby
60
+ Uiza.workspace_api_domain = ENV["WORKSPACE_API_DOMAIN"]
61
+ Uiza.authorization = ENV["AUTHORIZATION"]
62
+ ```
63
+
64
+ ## Entity
65
+ These below APIs used to take action with your media files (we called Entity).
66
+
67
+ See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/ENTITY.md).
68
+
69
+ ```ruby
70
+ begin
71
+ entity = Uiza::Entity.retrieve "your-entity-id"
72
+ puts entity.id
73
+ puts entity.name
74
+ rescue Uiza::Error::UizaError => e
75
+ puts "description_link: #{e.description_link}"
76
+ puts "code: #{e.code}"
77
+ puts "message: #{e.message}"
78
+ rescue StandardError => e
79
+ puts "message: #{e.message}"
80
+ end
81
+ ```
82
+
83
+ ## Category
84
+ Category has been splits into 3 types: `folder`, `playlist` and `tag`. These will make the management of entity more easier.
85
+
86
+ See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/CATEGORY.md).
87
+
88
+ ```ruby
89
+ require "uiza"
90
+
91
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
92
+ Uiza.authorization = "your-authorization"
93
+
94
+ begin
95
+ category = Uiza::Category.retrieve "your-category-id"
96
+ puts category.id
97
+ puts category.name
98
+ rescue Uiza::Error::UizaError => e
99
+ puts "description_link: #{e.description_link}"
100
+ puts "code: #{e.code}"
101
+ puts "message: #{e.message}"
102
+ rescue StandardError => e
103
+ puts "message: #{e.message}"
104
+ end
105
+ ```
106
+
107
+ ## Storage
108
+ You can add your storage (`FTP`, `AWS S3`) with UIZA.
109
+ After synced, you can select your content easier from your storage to [create entity](https://docs.uiza.io/#create-entity).
110
+
111
+ See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/STORAGE.md).
112
+
113
+ ```ruby
114
+ require "json"
115
+
116
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
117
+ Uiza.authorization = "your-authorization"
118
+
119
+ begin
120
+ storage = Uiza::Storage.retrieve "your-storage-id"
121
+ puts storage.id
122
+ puts storage.name
123
+ rescue Uiza::Error::UizaError => e
124
+ puts "description_link: #{e.description_link}"
125
+ puts "code: #{e.code}"
126
+ puts "message: #{e.message}"
127
+ rescue StandardError => e
128
+ puts "message: #{e.message}"
129
+ end
130
+ ```
131
+
132
+ ## Live Streaming
133
+ These APIs used to create and manage live streaming event.
134
+ * When a Live is not start : it's named as `Event`.
135
+ * When have an `Event` , you can start it : it's named as `Feed`.
136
+
137
+ See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/LIVE_STREAMING.md).
138
+
139
+ ## Callback
140
+ Callback used to retrieve an information for Uiza to your server, so you can have a trigger notice about an entity is upload completed and .
141
+
142
+ See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/CALLBACK.md).
143
+
144
+ ## Analytic
145
+ Monitor the four key dimensions of video QoS: playback failures, startup time, rebuffering, and video quality.
146
+ These 15 metrics help you track playback performance, so your team can know exactly what’s going on.
147
+
148
+ See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/ANALYTIC.md).
149
+
150
+ ## Embed Metadata
151
+ Embed metadata is information that can be embed into video/audio file. You can embed into file by adding a json compose these tag.
152
+
153
+ See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/EMBED_METADATA.md).
154
+
155
+ ## Errors Code
156
+ Uiza uses conventional HTTP response codes to indicate the success or failure of an API request.
157
+ In general: Codes in the `2xx` range indicate success.
158
+ Codes in the `4xx` range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.).
159
+ Codes in the `5xx` range indicate an error with Uiza's servers.
160
+
161
+ See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/ERRORS_CODE.md).
162
+
163
+ ## Development
164
+
165
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
166
+
167
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
168
+
169
+ ## Contributing
170
+
171
+ Bug reports and pull requests are welcome on GitHub at https://github.com/uizaio/api-wrapper-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
172
+
173
+ ## License
174
+
175
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
176
+
177
+ ## Code of Conduct
178
+
179
+ Everyone interacting in the Uiza project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/uizaio/api-wrapper-ruby/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec