pcloud 0.0.4 → 0.3.2

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: 488c8b94851e3db065174d08c512e6ecb55b0217d67df05f403c7616404491c8
4
- data.tar.gz: 56d94559f29edd8f1ce9e94307a1674ad880bc772aae137346efe3a63e9df91a
3
+ metadata.gz: d3df45fba37065a0d00e1ef805a2754f6d7da0cfb62a780bcd6e2f9a73bb3dad
4
+ data.tar.gz: 975423282e2a3919243368ace288b2f61d47eeb5408ee34f7f6578ad4852799d
5
5
  SHA512:
6
- metadata.gz: 3a80966ba741f5b3c9b8d4b522143db68f9f5e4561ac811df29c6ce6d0ccfae9b3ecf27fc81b9fbde57548e134245427e7cdb4a65a881d98c661dde4e24e6e3c
7
- data.tar.gz: 19b0ab6b6a4475a93994183f05a4ee3e72bad7a70176a2c859e30e022fbef36e778d33857a724f759901264417c7b96ee6785a48a77786490a3f3f458258eeee
6
+ metadata.gz: c2b0b1fbca1e202c8503259bf8035defab0a1dea551f94e907323c447511a37f250225b7e942fe73c1ffe581023ddd89d7e36992220bf47fa722230cc8e00b87
7
+ data.tar.gz: '088f4cec04d35a5eb422f2ae59e4d6affdf849dd4614bbe99edad6212233ffaf0b44c29812103b0aa0c23101276f0fd38967d2d1816324597d348a36a7589886'
data/CHANGELOG.md ADDED
@@ -0,0 +1,80 @@
1
+ # Changelog
2
+
3
+ ### [0.3.2](https://www.github.com/7urkm3n/pcloud/compare/v0.3.1...v0.3.2) (2021-09-05)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * filehandle error fixed ([45fae7c](https://www.github.com/7urkm3n/pcloud/commit/45fae7c42fd483b86d42c80fd9e6a11619933a40))
9
+
10
+ ### [0.3.1](https://www.github.com/7urkm3n/pcloud/compare/v0.3.0...v0.3.1) (2021-09-04)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * version update ([9bf5268](https://www.github.com/7urkm3n/pcloud/commit/9bf52681a94e6b17ec721778bfaeee39c1750a36))
16
+
17
+ ## [0.3.0](https://www.github.com/7urkm3n/pcloud/compare/v0.2.0...v0.3.0) (2021-09-04)
18
+
19
+
20
+ ### ⚠ BREAKING CHANGES
21
+
22
+ * initialization
23
+
24
+ ### Bug Fixes
25
+
26
+ * initialization ([6dc7735](https://www.github.com/7urkm3n/pcloud/commit/6dc77359c4bd3003ad05ed54705bfa70a6a95e62))
27
+
28
+ ## [0.2.0](https://www.github.com/7urkm3n/pcloud/compare/v0.1.0...v0.2.0) (2021-09-04)
29
+
30
+
31
+ ### ⚠ BREAKING CHANGES
32
+
33
+ * major update
34
+
35
+ ### Features
36
+
37
+ * major update ([3c1a191](https://www.github.com/7urkm3n/pcloud/commit/3c1a1914606391739f08e29c264528ba3d02d112))
38
+
39
+ ## 0.1.0 (2021-08-19)
40
+
41
+ ### Features
42
+
43
+ - version 0.1.0 ([bafbe4b](https://www.github.com/7urkm3n/pcloud/commit/bafbe4b1d0301eb99446c703176eb35d6dc41336))
44
+
45
+ ### Bug Fixes
46
+
47
+ - fixing workflow ([858cab4](https://www.github.com/7urkm3n/pcloud/commit/858cab495be548013c3e61756e626ce17cd38db3))
48
+ - workflows works, testing version auto bump ([9de8276](https://www.github.com/7urkm3n/pcloud/commit/9de82767c31c1ae003e268910b23108bba4f2e8c))
49
+
50
+ #### v0.0.4
51
+
52
+ ##### Updates
53
+
54
+ - Minor changes
55
+ - Upload and Download added and avilable now
56
+ - Post method is avilable now.
57
+ - Upload/Download async version is on work.
58
+
59
+ #### v0.0.3
60
+
61
+ ##### Updates
62
+
63
+ - Minor updates
64
+ - Upload and Download added - needs maintain
65
+ - Post method fixed and added back
66
+
67
+ #### v0.0.2
68
+
69
+ ##### Updates
70
+
71
+ - Minor updates
72
+ - Test files added
73
+ - Removed `Post` method temporarily
74
+
75
+ #### v0.0.1
76
+
77
+ ##### Publish
78
+
79
+ - Available get Method
80
+ - Incoming {Upload|Download} files
data/README.md CHANGED
@@ -2,25 +2,28 @@
2
2
 
3
3
  This Gem provides a Ruby interface to [Pcloud.com](https://docs.pcloud.com).
4
4
 
5
- [![Build Status](https://github.com/7urkm3n/pcloud/workflows/build/badge.svg?branch=master)](https://github.com/7urkm3n/pcloud/actions?query=workflow%3Abuild) [![Gem Downloads](https://badgen.net/rubygems/dt/pcloud)](https://rubygems.org/gems/pcloud) [![Gem Version](https://badge.fury.io/rb/pcloud.svg)](https://badge.fury.io/rb/pcloud)
5
+ [![Build Status](https://github.com/7urkm3n/pcloud/workflows/release/badge.svg?branch=main)](https://github.com/7urkm3n/pcloud/actions?query=workflow%3Arelease) [![Gem Downloads](https://badgen.net/rubygems/dt/pcloud)](https://rubygems.org/gems/pcloud) [![Gem Version](https://badge.fury.io/rb/pcloud.svg)](https://badge.fury.io/rb/pcloud)
6
6
 
7
7
  <!-- [![Gem Version](https://badgen.net/rubygems/v/pcloud)](https://rubygems.org/gems/pcloud) -->
8
8
 
9
+ ##### Want to contribute? [Doc Link](https://github.com/7urkm3n/pcloud/CONTRIBUTE.md)
10
+
9
11
  ## Installation and Configuration
10
12
 
11
13
  Add `pcloud` to your Gemfile, and then run `bundle install`
12
14
 
13
- ``` ruby
15
+ ```ruby
14
16
  gem 'pcloud'
15
17
  ```
16
18
 
17
19
  or install via gem
18
20
 
19
- ``` bash
21
+ ```bash
20
22
  gem install pcloud
21
23
  ```
22
24
 
23
25
  ###### Rails
26
+
24
27
  to generate `Rails` initializer file
25
28
 
26
29
  ```bash
@@ -35,87 +38,109 @@ config/initializers/pcloud.rb
35
38
 
36
39
  ### Instantiating a client
37
40
 
38
- ``` ruby
41
+ ```ruby
39
42
  require 'pcloud'
40
43
 
41
44
  pcloud = Pcloud::Client.new(
42
45
  username: 'email',
43
46
  password: 'password',
44
- )
45
- ```
47
+ ).authenticate
46
48
 
49
+ pcloud.get("listfolder", folderid: 0)
50
+ ```
47
51
 
48
52
  ### Global configuration
49
53
 
50
54
  The library can also be configured globally on the `Pcloud` class.
51
55
 
52
- ``` ruby
56
+ ```ruby
53
57
  Pcloud.username = 'email'
54
58
  Pcloud.password = 'password'
59
+ Pcloud.authenticate
60
+
61
+ Pcloud.get("listfolder", folderid: 0)
55
62
  ```
56
63
 
57
- <!-- ### Logging
64
+ ### Logging
58
65
 
59
66
  By default errors are logged in STDOUT level, also `Rails.logger` available.
60
67
 
61
- ``` ruby
68
+ ```ruby
62
69
  Pcloud.logger = Rails.logger
63
- ``` -->
70
+ ```
71
+
72
+ ### Working with methods
64
73
 
65
- ## Working with methods
74
+ Available methods:
66
75
 
67
- Currently, only available custom Get method.
76
+ - <b> Get </b>
77
+ - <b> Post </b>
78
+ - <b> File handling </b>
68
79
 
69
- File Upload and Download methods are coming soon.
80
+ ###### addition!
70
81
 
82
+ > Some apis need to be `raw` format, just add `raw` in params. `params: {fileid: ..987, raw: true}`
83
+ > For example `gettextfile` https://docs.pcloud.com/methods/streaming/gettextfile.html
71
84
 
72
- #### Get methods
85
+ #### Get method
73
86
 
74
- ``` ruby
87
+ ```ruby
75
88
  Pcloud.get("getip")
76
89
  Pcloud.get("getdigest")
77
90
 
78
91
  # with params
79
- Pcloud.get("listfolder", folderid: 0)
92
+ params = {folderid: 0}
93
+ Pcloud.get("listfolder", params)
80
94
  ```
81
- <!-- Pcloud.get("createfolder", folderid: 0, name: "new folder name", ...) -->
82
-
83
- #### Post methods
84
95
 
85
- ``` ruby
86
- # if any of pcloud endpoints requires payload on POST request, please create an issue.
96
+ #### Post method
87
97
 
88
- # with params
89
- Pcloud.post("createfolder", folderid: 0, name: "new folder name")
98
+ ```ruby
99
+ payload = {}
100
+ params = {folderid: 0, name: "new folder name"}
101
+ Pcloud.post("createfolder", payload, params)
90
102
  ```
91
103
 
92
- #### [Files](https://docs.pcloud.com/methods/file/)
104
+ ### [File methods](https://docs.pcloud.com/methods/file/)
105
+
93
106
  ##### [Download File](https://docs.pcloud.com/methods/file/downloadfile.html)
94
107
 
95
- ``` ruby
96
- #obtain filelink from: https://docs.pcloud.com/methods/streaming/getfilelink.html
108
+ ```ruby
109
+ # optional params: filename, destination
110
+ # destination by default current_path
111
+ Pcloud.file.download({fileid: 987532135})
97
112
 
98
113
  Pcloud.file.download(
99
- url: filelink, #required
100
- destination: "#{Dir.pwd}/Downloads", #required
101
- filename: "hehe.txt" #optional
114
+ fileid: 987532135, #required
115
+ destination: "#{Dir.pwd}/Downloads", #optional
116
+ filename: "hehe.txt" #optional
102
117
  )
103
118
  ```
104
119
 
105
- ##### [Upload File](https://docs.pcloud.com/methods/file/uploadfile.html)
120
+ ##### [Download Folder](#)
106
121
 
107
- ``` ruby
108
- # still in BETA! -
109
- # only supports single file download
122
+ ```ruby
123
+ # optional params: filename, destination
124
+ # destination by default current_path
125
+ Pcloud.file.download_folder({folderid: 123456789})
126
+ ```
127
+
128
+ ##### [Upload File](https://docs.pcloud.com/methods/file/uploadfile.html)
110
129
 
111
- file = File.open("/Users/7urkm3n/Downloads/anything.file")
130
+ ```ruby
112
131
  params = {
113
- folderid: 0, #required
114
- filename: "anything.txt" #required
132
+ folderid: 0, #required
133
+ nopartial: 1,
115
134
  }
116
- payload = {file: file}
135
+ # multiple uploads
136
+ file1 = File.open("./Rakefile")
137
+ file2 = File.open("./README.md")
138
+ file3 = File.open("./Gemfile")
139
+ payload = { files: [file1,file2,file3] }
140
+
117
141
  Pcloud.file.upload(params, payload)
118
142
  ```
119
143
 
120
144
  ### Supported Ruby versions
145
+
121
146
  2.2+
data/lib/pcloud/client.rb CHANGED
@@ -1,51 +1,63 @@
1
1
  require 'json'
2
2
  require 'rest-client'
3
+ require_relative './request'
4
+ require_relative "./files/file_handler"
3
5
 
4
6
  module Pcloud
5
7
  class Client
6
8
  attr_writer :username, :password
9
+ attr_accessor :auth_token
7
10
 
8
11
  def initialize(options = {})
9
12
  @username, @password = options.values_at(:username, :password)
13
+ @auth_token = options[:auth_token]
10
14
  end
11
15
 
12
- def get(path, params = {})
13
- resource(path).get(params)
16
+ def get(path, params={})
17
+ request(:get, path, params)
14
18
  end
15
19
 
16
- def post(path, params = {})
17
- resource(path).post(params)
20
+ def post(path, payload={}, params={})
21
+ request(:post, path, params, payload)
18
22
  end
19
23
 
20
24
  def file
21
- Resource.new(self).file()
25
+ @file ||= FileHandler.new(self)
22
26
  end
23
27
 
24
28
  def http_client
25
- @client ||= RestClient::Resource.new(BASE_URL)
29
+ @http_client ||= RestClient::Resource.new(BASE_URL)
26
30
  end
27
31
 
28
- def auth
29
- @auth ||= begin
30
- raise ConfigurationError, :username unless @username
31
- raise ConfigurationError, :password unless @password
32
- digest = JSON.parse(RestClient.get("#{BASE_URL}/getdigest"))['digest']
33
- passworddigest = digest_data(@password + digest_data( @username.downcase ) + digest)
34
- JSON.parse(
35
- RestClient.get("#{BASE_URL}/userinfo?getauth=1&logout=1",
36
- {params: {username: @username, digest: digest, passworddigest: passworddigest}})
37
- )['auth']
38
- end
32
+ def authenticate(options = {})
33
+ @auth_token = authorize(options)['auth']
34
+ self
39
35
  end
40
36
 
41
- private
42
-
43
- def resource(path)
44
- Resource.new(self, path)
37
+ def request(verb, path, params, payload = {})
38
+ Pcloud::Request.call(self, verb, path, params, payload)
39
+ end
40
+
41
+ private
42
+ def authorize(options)
43
+ raise ConfigurationError, :username unless @username
44
+ raise ConfigurationError, :password unless @password
45
+ digest = JSON.parse(RestClient.get("#{BASE_URL}/getdigest"))['digest']
46
+ passworddigest = digest_data(@password + digest_data( @username.downcase ) + digest)
47
+ [:username, :digest, :passworddigest, :password].each { |k| options.delete(k) }
48
+ params = {params: {
49
+ username: @username,
50
+ digest: digest,
51
+ passworddigest: passworddigest,
52
+ device: "pcloud-ruby",
53
+ getauth: 1
54
+ }.merge!(options)}
55
+ JSON.parse(RestClient.get("#{BASE_URL}/userinfo", params)) #['auth']
45
56
  end
46
57
 
47
58
  def digest_data text
48
59
  Digest::SHA1.hexdigest(text)
49
60
  end
61
+
50
62
  end
51
63
  end
@@ -6,6 +6,11 @@ module Pcloud
6
6
  super "missing key `#{key}' in the client configuration"
7
7
  end
8
8
  end
9
+ class NotFoundError < Error
10
+ def initialize(key, message)
11
+ super "not found `#{key}' with value of #{message}"
12
+ end
13
+ end
9
14
  class HTTPError < Error
10
15
  def initialize(key, message)
11
16
  super "#{key} Bad request: #{message}"
@@ -1,35 +1,49 @@
1
- require 'RestClient'
1
+ require 'open-uri'
2
+ require 'zip'
2
3
 
3
4
  module Pcloud
4
5
  class FileHandler
6
+
5
7
  def initialize(client)
6
8
  @client = client
7
9
  end
8
10
 
9
11
  def upload(params, payload)
10
- create_request(:post, 'uploadfile', params, payload).call
12
+ @client.request(:post, 'uploadfile', params, payload)
11
13
  end
12
14
 
13
15
  def download(params)
14
- url = params[:url]
15
- begin
16
- res = RestClient.get(url)
17
- rescue => e
18
- raise HTTPError.new(:HTTPError, e.message)
19
- end
20
-
21
- filename = params[:filename] ? params[:filename] : url.split("/").last
22
- File.open("#{params[:destination]}/#{filename}", 'wb' ) do |f|
23
- f.write
16
+ # destination = params[:destination] ? params[:destination] : '.'
17
+ # data = request(:get, "getfilelink", {fileid: params[:fileid], forcedownload: 1})
18
+ # url = "https://#{data[:hosts][0]+data[:path]}"
19
+ # IO.copy_stream(URI.open(url), "#{destination}/#{url.split("/").last}")
20
+ # File.write("#{destination}/#{url.split("/").last}", URI.open(url).read)
21
+
22
+ destination = params[:destination] || '.'
23
+ filename = params[:filename] || nil
24
+ if !filename
25
+ stat = @client.request(:get, "stat", {fileid: params[:fileid]})
26
+ raise NotFoundError.new(:fileid, params[:fileid]) if stat[:error]
27
+ filename = stat[:metadata][:name]
24
28
  end
25
- res.code
26
- end
29
+ File.write("#{destination}/#{filename}", @client.request(:get, "gettextfile", {fileid: params[:fileid], raw: true}))
30
+ end
27
31
 
28
- private
32
+ def download_folder(params)
33
+ data = @client.request(:get, "listfolder", {folderid: params[:folderid]})
34
+ raise NotFoundError.new(:folderid, params[:folderid]) if data[:error]
29
35
 
30
- def create_request(verb, path, params, payload = {})
31
- Request.new(@client, verb, path, params, payload)
36
+ destination = params[:destination] || '.'
37
+ folder_name = params[:filename] || data[:metadata][:name] << ".zip"
38
+ stringio = Zip::OutputStream::write_buffer do |zio|
39
+ data[:metadata][:contents].each do |content|
40
+ zio.put_next_entry(content[:name])
41
+ zio.write(@client.request(:get, "gettextfile", {fileid: content[:fileid], raw: true}))
42
+ end
43
+ end
44
+ stringio.rewind #reposition buffer pointer to the beginning
45
+ File.new("#{destination}/#{folder_name}","wb").write(stringio.sysread) #write buffer to zipfile
32
46
  end
33
-
47
+
34
48
  end
35
49
  end
@@ -1,46 +1,43 @@
1
1
  module Pcloud
2
- class Request
3
- def initialize(client, verb, path, params, payload)
4
- @client, @verb, @path, @params, @payload = client, verb, path, params, payload
5
- end
6
-
7
- def call
8
- params = {params: {}}
9
- params[:params].merge!(@params, {auth: @client.auth})
10
- http = @client.http_client
11
- res = case @verb
12
- when :get
13
- begin
14
- http[@path].get(params)
15
- rescue => e
16
- handle_response(e.http_code, e.message)
17
- end
18
- when :post
19
- begin
20
- http[@path].post(@payload, params)
21
- rescue => e
22
- handle_response(e.http_code, e.message)
2
+ module Request
3
+ class << self
4
+ def call(client, verb, path, params, payload={})
5
+ params = {params: {}.merge!(params, {auth: client.auth_token})}
6
+ http = client.http_client
7
+ res = case verb
8
+ when :get
9
+ begin
10
+ http[path].get(params)
11
+ rescue => e
12
+ handle_response(e.http_code, e.message)
13
+ end
14
+ when :post
15
+ begin
16
+ http[path].post(payload, params)
17
+ rescue => e
18
+ handle_response(e.http_code, e.message)
19
+ end
20
+ else
21
+ raise "Unsupported verb (get and post available): #{verb}"
23
22
  end
24
- else
25
- raise "Unsupported verb: #{@verb}"
26
- end
27
- JSON.parse(res.body, { symbolize_names: true })
28
- end
23
+ return res.body if params[:params][:raw]
24
+ JSON.parse(res.body, { symbolize_names: true })
25
+ end
29
26
 
30
27
  private
31
28
 
32
- def handle_response(status_code, body)
33
- case status_code
34
- when 400
35
- raise HTTPError.new(:HTTPError, body)
36
- when 401
37
- raise AuthenticationError, body
38
- when 404
39
- raise HTTPError.new(:HTTPError, body)
40
- else
41
- raise Error, "Unknown error (status code #{status_code}): #{body}"
29
+ def handle_response(status_code, body)
30
+ case status_code
31
+ when 400
32
+ raise HTTPError.new(:HTTPError, body)
33
+ when 401
34
+ raise AuthenticationError, body
35
+ when 404
36
+ raise HTTPError.new(:HTTPError, body)
37
+ else
38
+ raise Error, "Unknown error (status code #{status_code}): #{body}"
39
+ end
42
40
  end
43
41
  end
44
-
45
42
  end
46
43
  end
@@ -1,3 +1,3 @@
1
1
  module Pcloud
2
- VERSION = '0.0.4'
2
+ VERSION = '0.3.2'
3
3
  end
data/lib/pcloud.rb CHANGED
@@ -1,17 +1,21 @@
1
1
  autoload 'Logger', 'logger'
2
2
  require 'forwardable'
3
- require 'pcloud/client'
3
+ require_relative 'pcloud/client'
4
4
 
5
5
  module Pcloud
6
6
  BASE_URL = 'https://api.pcloud.com'.freeze
7
7
 
8
8
  class << self
9
9
  extend Forwardable
10
- def_delegators :default_client, :username=, :password=
11
- def_delegators :default_client, :get
10
+ def_delegators :client, :auth_token=, :username=, :password=
11
+ def_delegators :client, :get, :post, :file, :authenticate
12
12
 
13
13
  attr_writer :logger
14
14
 
15
+ def client
16
+ @client ||= Pcloud::Client.new
17
+ end
18
+
15
19
  def logger
16
20
  @logger ||= begin
17
21
  log = Logger.new($stdout)
@@ -20,13 +24,8 @@ module Pcloud
20
24
  end
21
25
  end
22
26
 
23
- def default_client
24
- @default_client ||= Pcloud::Client.new
25
- end
26
27
  end
27
28
  end
28
29
 
29
- require 'pcloud/version'
30
- require 'pcloud/request'
31
- require 'pcloud/resource'
32
- require 'pcloud/exceptions'
30
+ require_relative './pcloud/version'
31
+ require_relative './pcloud/exceptions'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rovshen Gurdov
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-03 00:00:00.000000000 Z
11
+ date: 2021-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.2.0
47
+ version: 1.3.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.2.0
54
+ version: 1.3.2
55
55
  description: Pcloud is cloud storage upload/download/share from pcloud.com. Please,
56
56
  check available methods in Github Doc...
57
57
  email:
@@ -60,7 +60,7 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - Changelog.md
63
+ - CHANGELOG.md
64
64
  - LICENSE
65
65
  - README.md
66
66
  - lib/generators/pcloud.rb
@@ -70,14 +70,13 @@ files:
70
70
  - lib/pcloud/exceptions.rb
71
71
  - lib/pcloud/files/file_handler.rb
72
72
  - lib/pcloud/request.rb
73
- - lib/pcloud/resource.rb
74
73
  - lib/pcloud/version.rb
75
- homepage: https://github.com/7urkm3n/pcloud/
74
+ homepage: https://github.com/7urkm3n/pcloud
76
75
  licenses:
77
76
  - MIT
78
77
  metadata:
79
78
  bug_tracker_uri: https://github.com/7urkm3n/pcloud/issues
80
- changelog_uri: https://github.com/7urkm3n/pcloud/blob/master/Changelog.md
79
+ changelog_uri: https://github.com/7urkm3n/pcloud/blob/master/CHANGELOG.md
81
80
  documentation_uri: https://github.com/7urkm3n/pcloud
82
81
  source_code_uri: https://github.com/7urkm3n/pcloud
83
82
  post_install_message:
@@ -95,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
94
  - !ruby/object:Gem::Version
96
95
  version: '0'
97
96
  requirements: []
98
- rubygems_version: 3.0.3
97
+ rubygems_version: 3.2.3
99
98
  signing_key:
100
99
  specification_version: 4
101
100
  summary: Secure and simple to use cloud storage for your datas...
data/Changelog.md DELETED
@@ -1,32 +0,0 @@
1
- ### Changelogs:
2
-
3
- #### v0.0.4
4
- ##### Updates
5
- * Minor changes
6
- * Upload and Download added and avilable now
7
- * Post method is avilable now.
8
- * Upload/Download async version is on work.
9
-
10
- #### v0.0.3
11
- ##### Updates
12
- * Minor updates
13
- * Upload and Download added - needs maintain
14
- * Post method fixed and added back
15
-
16
- #### v0.0.2
17
- ##### Updates
18
- * Minor updates
19
- * Test files added
20
- * Removed `Post` method temporarily
21
-
22
- #### v0.0.1
23
- ##### Publish
24
- * Available get Method
25
- * Incoming {Upload|Download} files
26
-
27
-
28
-
29
- <!-- === 0.0.2 / 2020-09-...
30
- ==== Updates | Enhancements
31
- * Added to {Upload|Download} files.
32
- -->
@@ -1,29 +0,0 @@
1
- require "#{Dir.pwd}/lib/pcloud/files/file_handler"
2
-
3
- module Pcloud
4
- class Resource
5
-
6
- def initialize(client, path = "")
7
- @client, @path = client, path
8
- end
9
-
10
- def get(params)
11
- create_request(:get, params).call
12
- end
13
-
14
- def post(params, payload = {})
15
- create_request(:post, params, payload).call
16
- end
17
-
18
- def file
19
- @file ||= FileHandler.new(@client)
20
- end
21
-
22
- private
23
-
24
- def create_request(verb, params, payload = {})
25
- Request.new(@client, verb, @path, params, payload)
26
- end
27
-
28
- end
29
- end