platformcraft-filespot 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/lib/filespot/client/objects.rb +21 -2
- data/lib/filespot/request.rb +2 -1
- data/lib/filespot/version.rb +1 -1
- metadata +15 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35dccadd089a759ce2a50795b5732e8799662c7d
|
4
|
+
data.tar.gz: 1b0981f71db5ca94c4a4a33e8bc86c3df2b8b394
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db1b43004260f73c12c3563fb0e65d8edb95a314676c2968c194e0b08fecc2fad54a954e42abe34a98cae83c1c1d37d0a23e4c2858d26ba1f3ee6b3717ae97e1
|
7
|
+
data.tar.gz: a77f09f9c38d0ae29bc09a49a9655431cd09db38e1e2a105103c56cc64e4e9592199641e8b4d323c456af1c72c67d4319cff988313bfb6267106bc587a41cc76
|
@@ -1,7 +1,11 @@
|
|
1
1
|
module Filespot
|
2
2
|
module Objects
|
3
|
-
def
|
4
|
-
|
3
|
+
def exists?(path)
|
4
|
+
!!get_object_by_path(path)
|
5
|
+
end
|
6
|
+
|
7
|
+
def get_objects(folder=nil)
|
8
|
+
res = Response.new(Request.get("/objects", folder: folder))
|
5
9
|
return [] unless res.code == 200
|
6
10
|
|
7
11
|
arr = []
|
@@ -28,6 +32,21 @@ module Filespot
|
|
28
32
|
res = Response.new(Request.delete("/objects/#{object_id}"))
|
29
33
|
res
|
30
34
|
end
|
35
|
+
|
36
|
+
def delete_object_by_path(path)
|
37
|
+
object = get_object_by_path path
|
38
|
+
return delete_object(object.id) if object
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_object_by_path(path)
|
43
|
+
full_path = path[0] == '/' ? path : "/#{path}"
|
44
|
+
folder = File.dirname full_path
|
45
|
+
get_objects(folder).each do |object|
|
46
|
+
return object if object.path == full_path
|
47
|
+
end
|
48
|
+
nil
|
49
|
+
end
|
31
50
|
end
|
32
51
|
|
33
52
|
class Object
|
data/lib/filespot/request.rb
CHANGED
@@ -43,8 +43,9 @@ module Filespot
|
|
43
43
|
def self.api_uri(http_method, api_method, params)
|
44
44
|
uri = URI("https://" + Filespot.url)
|
45
45
|
uri.path = "/#{Filespot.version}#{api_method}"
|
46
|
-
uri.query = URI.encode_www_form(
|
46
|
+
uri.query = URI.encode_www_form(default_params)
|
47
47
|
uri.query += "&hash=#{Digest.hmac(http_method, uri.to_s)}"
|
48
|
+
uri.query += "&#{URI.encode_www_form(params)}" if params.any?
|
48
49
|
uri
|
49
50
|
end
|
50
51
|
end
|
data/lib/filespot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: platformcraft-filespot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- droff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -132,9 +132,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.6.2
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: http://doc.platformcraft.ru/filespot/api/
|
139
|
-
test_files:
|
140
|
-
|
139
|
+
test_files:
|
140
|
+
- spec/fixtures/download_tasks.json
|
141
|
+
- spec/fixtures/download_tasks_id.json
|
142
|
+
- spec/fixtures/objects.json
|
143
|
+
- spec/fixtures/objects_id.json
|
144
|
+
- spec/fixtures/objects_post.json
|
145
|
+
- spec/lib/client/download_spec.rb
|
146
|
+
- spec/lib/client/objects_spec.rb
|
147
|
+
- spec/lib/client_spec.rb
|
148
|
+
- spec/lib/digest_spec.rb
|
149
|
+
- spec/lib/response_spec.rb
|
150
|
+
- spec/spec_helper.rb
|