streamsb 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45b92014d373523ec893250475955c1bc1eea0e65bcbbe6e5bd92b003bb1e9c5
4
- data.tar.gz: 933c8d8fcca5cfb6164e3f15d3944f13977a0b0e0bf72e0e79d817d90625516f
3
+ metadata.gz: '09e33784672493e91d5d4d3f97aaebda1c493cfedde9f68232ed1280b4fb6bd8'
4
+ data.tar.gz: 285e37887f26d1b5b25c2ff0202e1bc301131076009a56802d5c85c9c904dbfe
5
5
  SHA512:
6
- metadata.gz: d8e445b2e2d3475936456140108a1735fbe2fcfbe3472abcd0b6aa7b581dd021d24876ac2bd7821330d8fcf589200838d482c604c9a1fcc449b60b5e00ba0158
7
- data.tar.gz: 50641ab9ca0cc10e64fd4f0b5e45bcb1776c8e780359c1a76a317ae2fcc42bfc774de7620ce147b9075f7c313c283c3279f6d22aef76915aaae9a8ab740c3eef
6
+ metadata.gz: 77ed310bb8f2cc83768383f63a051c7c879500413e9ffa747745753f0fbed828c1abd57bd60a4395485b3b1c628f4af8804d3c8984a73935a166ad4019d5a468
7
+ data.tar.gz: 82dbccb05d37e744259e0d0aed8275600886952957096e2b45a46a0d76dc195b250625e024652575656fbde98b08cccac522f9dbecc78f4dd0e296c167579c41
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- streamsb (0.1.1)
4
+ streamsb (0.2.1)
5
5
  faraday (~> 1.7)
6
6
  faraday_middleware (~> 1.2)
7
7
  json
data/README.md CHANGED
@@ -10,6 +10,10 @@ If bundler is not being used to manage dependencies, install the gem by executin
10
10
 
11
11
  gem install streamsb
12
12
 
13
+ Alternatively, you can opt for Github's installation, add this to your gem file:
14
+
15
+ gem 'streamsb', github: 'ochiengotieno304/streamsb-ruby'
16
+
13
17
  ## Usage
14
18
 
15
19
  ### Initialize Streamsb Client
@@ -95,6 +99,8 @@ direct_quality = @client.get_direct_quality(file_code, quality)
95
99
  - `file_code`: file code `REQUIRED`
96
100
  - `quality`: video quality if exist, possible values: `n` , `h` , `l` `OPTIONAL`
97
101
 
102
+ ### 2.7 Set Folder
103
+
98
104
  ```ruby
99
105
  set_folder = @client.set_folder(file_code, folder_id)
100
106
  ```
@@ -102,15 +108,70 @@ set_folder = @client.set_folder(file_code, folder_id)
102
108
  - `file_code`: file code `REQUIRED`
103
109
  - `folder_id`: folder id `REQUIRED`
104
110
 
105
- ## Development
111
+ ## 3. Folder
112
+
113
+ ### 3.1 List Files
114
+
115
+ ```ruby
116
+ files = @client.folder_list(folder_id)
117
+ ```
118
+
119
+ - `folder_id`: folder id `REQUIRED`
120
+
121
+ ### 3.2 Create Folder
122
+
123
+ ```ruby
124
+ folder = @client.create_folder(name, folder_id)
125
+ ```
126
+
127
+ - `name`: folder name `REQUIRED`
128
+ - `folder_id`: parent folder id `OPTIONAL`
129
+
130
+ ## 4. Upload File
131
+
132
+ ### 4.1 Get Server
133
+
134
+ ```ruby
135
+ upload_server = @client.upload_server
136
+ ```
137
+
138
+ ### 4.2 Upload File
139
+
140
+ > **Note:**
141
+ > Will be in later realeases
142
+
143
+ ## 5. Upload Url
144
+
145
+ ### 5.1 Add Url
146
+
147
+ ```ruby
148
+ url = @client.add_url(url)
149
+ ```
150
+
151
+ - `url`: upload url `REQUIRED`
152
+
153
+ ### 5.2 List Url
154
+
155
+ ```ruby
156
+ urls = @client.list_url
157
+ ```
158
+
159
+ ### 5.3 Status
160
+
161
+ ```ruby
162
+ status = @client.url_status(file_code)
163
+ ```
164
+
165
+ - `file_code`: file_code `REQUIRED`
106
166
 
107
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
167
+ ### 5.4 Action
108
168
 
109
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
169
+ > **Note:**
170
+ > Will be in later releases
110
171
 
111
172
  ## Contributing
112
173
 
113
- Bug reports and pull requests are welcome on GitHub at <https://github.com/[USERNAME>]/streamsb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/streamsb/blob/main/CODE_OF_CONDUCT.md).
174
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/ochiengotieno304/streamsb-ruby>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ochiengotieno304/streamsb-ruby/blob/main/CODE_OF_CONDUCT.md).
114
175
 
115
176
  ## License
116
177
 
@@ -118,4 +179,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
118
179
 
119
180
  ## Code of Conduct
120
181
 
121
- Everyone interacting in the Streamsb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/streamsb/blob/main/CODE_OF_CONDUCT.md).
182
+ Everyone interacting in the Streamsb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ochiengotieno304/streamsb-ruby/blob/main/CODE_OF_CONDUCT.md).
@@ -16,48 +16,44 @@ module Streamsb
16
16
  end
17
17
 
18
18
  def account_info
19
- data = {
20
- key: api_key
21
- }
22
- request(http_method: :get, endpoint: "account/info", params: data)
19
+ request(http_method: :get, endpoint: "account/info", params: payload)
23
20
  end
24
21
 
25
22
  def account_stats
26
- data = {
27
- key: api_key
28
- }
29
- request(http_method: :get, endpoint: "account/stats", params: data)
23
+ request(http_method: :get, endpoint: "account/stats", params: payload)
30
24
  end
31
25
 
32
26
  def file_info(file_code)
33
27
  data = {
34
- key: api_key,
35
28
  file_code: file_code
36
29
  }
37
- request(http_method: :get, endpoint: "file/info", params: data)
30
+
31
+ params = payload.merge!(data)
32
+ request(http_method: :get, endpoint: "file/info", params: params)
38
33
  end
39
34
 
40
35
  def rename_file(file_code, title, name)
41
36
  data = {
42
- key: api_key,
43
37
  file_code: file_code,
44
38
  title: title,
45
39
  name: name
46
40
  }
47
- request(http_method: :get, endpoint: "file/rename", params: data)
41
+
42
+ params = payload.merge!(data)
43
+ request(http_method: :get, endpoint: "file/rename", params: params)
48
44
  end
49
45
 
50
46
  def clone_file(file_code)
51
47
  data = {
52
- key: api_key,
53
48
  file_code: file_code
54
49
  }
55
- request(http_method: :get, endpoint: "file/clone", params: data)
50
+
51
+ params = payload.merge!(data)
52
+ request(http_method: :get, endpoint: "file/clone", params: params)
56
53
  end
57
54
 
58
55
  def list_files(page = nil, per_page = nil, fld_id = nil, is_public = nil, created = nil, title = nil)
59
56
  data = {
60
- key: api_key,
61
57
  page: page,
62
58
  per_page: per_page,
63
59
  fld_id: fld_id,
@@ -66,36 +62,82 @@ module Streamsb
66
62
  title: title
67
63
  }
68
64
 
69
- request(http_method: :get, endpoint: "file/list", params: data)
65
+ params = payload.merge!(data)
66
+ request(http_method: :get, endpoint: "file/list", params: params)
70
67
  end
71
68
 
72
69
  def get_direct_all(file_code)
73
70
  data = {
74
- key: api_key,
75
71
  file_code: file_code
76
72
  }
77
73
 
78
- request(http_method: :get, endpoint: "file/direct", params: data)
74
+ params = payload.merge!(data)
75
+ request(http_method: :get, endpoint: "file/direct", params: params)
79
76
  end
80
77
 
81
78
  def get_direct_quality(file_code, quality = nil)
82
79
  data = {
83
- key: api_key,
84
80
  file_code: file_code,
85
81
  q: quality
86
82
  }
87
83
 
88
- request(http_method: :get, endpoint: "file/direct_link", params: data)
84
+ params = payload.merge!(data)
85
+ request(http_method: :get, endpoint: "file/direct_link", params: params)
89
86
  end
90
87
 
91
88
  def set_folder(file_code, folder_id)
92
89
  data = {
93
- key: api_key,
94
90
  file_code: file_code,
95
- folder_id: folder_id
91
+ fld_id: folder_id
92
+ }
93
+
94
+ params = payload.merge!(data)
95
+ request(http_method: :get, endpoint: "file/set_folder", params: params)
96
+ end
97
+
98
+ def folder_list(folder_id)
99
+ data = {
100
+ fld_id: folder_id
101
+ }
102
+
103
+ params = payload.merge!(data)
104
+ request(http_method: :get, endpoint: "folder/list", params: params)
105
+ end
106
+
107
+ def create_folder(name, folder_id = nil)
108
+ data = {
109
+ name: name,
110
+ fld_id: folder_id
96
111
  }
97
112
 
98
- request(http_method: :get, endpoint: "file/set_folder", params: data)
113
+ params = payload.merge!(data)
114
+ request(http_method: :get, endpoint: "folder/create", params: params)
115
+ end
116
+
117
+ def upload_server
118
+ request(http_method: :get, endpoint: "upload/server", params: payload)
119
+ end
120
+
121
+ def add_url(url)
122
+ data = {
123
+ url: url
124
+ }
125
+
126
+ params = payload.merge!(data)
127
+ request(http_method: :get, endpoint: "upload/url", params: params)
128
+ end
129
+
130
+ def list_url
131
+ request(http_method: :get, endpoint: "url/list", params: payload)
132
+ end
133
+
134
+ def url_status(file_code)
135
+ data = {
136
+ file_code: file_code
137
+ }
138
+
139
+ params = payload.merge!(data)
140
+ request(http_method: :get, endpoint: "file/url_uploads", params: params)
99
141
  end
100
142
 
101
143
  def inspect
@@ -104,6 +146,12 @@ module Streamsb
104
146
 
105
147
  private
106
148
 
149
+ def payload
150
+ {
151
+ key: api_key
152
+ }
153
+ end
154
+
107
155
  def connection
108
156
  @connection ||= Faraday.new do |conn|
109
157
  conn.url_prefix = API_ENDPOINT
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Streamsb
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: streamsb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ochieng Otieno
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-24 00:00:00.000000000 Z
11
+ date: 2022-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday