qnap-file_station 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/lib/qnap/file_station.rb +8 -5
- data/qnap-file_station.gemspec +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5b17e28b82aa0b9bd84caad5770597a5c2583cf
|
4
|
+
data.tar.gz: f32a9a1d6fb8b94567858240380a09e6f451346c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a4aad404e2a946c721b01e15d21eb0b17a9189a68b1c11533edf5fb7feda00215ba36c5d687b0804b53b80ceff41ae53f54f1ead168dd376e9bd7f801309492
|
7
|
+
data.tar.gz: 94334ac4acc3435d43d0e4889064463ff9754436d2eae99a0be96fa87376173c6f647d44cb2f01368875884e5c52a4e470a3e913f475e83b6edf0ce1037244c7
|
data/README.md
CHANGED
@@ -41,13 +41,15 @@ end
|
|
41
41
|
|
42
42
|
Constants
|
43
43
|
-------
|
44
|
-
`Qnap::FileStation::DEBUG`, default: `false`. Print extensive debugging information to
|
45
|
-
|
44
|
+
`Qnap::FileStation::DEBUG`, default: `false`. Print extensive debugging information to `$stdout` if `true`
|
45
|
+
|
46
|
+
`Qnap::FileStation::DISCARD_EXTRANEOUS`, default: `true`, Discard any parameters we're not expecting before despatching to the API
|
47
|
+
|
46
48
|
`Qnap::FileStation::PROTOCOL`, default: `"https"`
|
47
49
|
|
48
50
|
Exceptions
|
49
51
|
-------
|
50
|
-
API communication errors will raise a Qnap::ApiError exception. The message will indicate what went wrong, the `uri` method will return the URI that was being queried at the time, and
|
52
|
+
API communication errors will raise a `Qnap::ApiError` exception. The message will indicate what went wrong, the `uri` method will return the URI that was being queried at the time, and the `response` method will return the `Net::HTTPResponse` response
|
51
53
|
|
52
54
|
```ruby
|
53
55
|
begin
|
data/lib/qnap/file_station.rb
CHANGED
@@ -137,12 +137,15 @@ module Qnap
|
|
137
137
|
raise "Error response from #{uri} -> #{response.read_body}"
|
138
138
|
end
|
139
139
|
|
140
|
-
|
141
|
-
|
140
|
+
case response['content-type']
|
141
|
+
when /application\/json/
|
142
|
+
data = JSON.parse response.read_body, symbolize_names: true
|
143
|
+
when /application\/force-download/
|
144
|
+
data = response.read_body.force_encoding('UTF-8')
|
145
|
+
else
|
146
|
+
raise "Don't know how to parse #{response['content-type']}"
|
142
147
|
end
|
143
|
-
|
144
|
-
data = JSON.parse response.read_body, symbolize_names: true
|
145
|
-
|
148
|
+
|
146
149
|
if data.respond_to?(:key?) and data.key?(:status) and data[:status] != 1
|
147
150
|
raise Qnap::ApiError.new data[:status], uri, response
|
148
151
|
end
|
data/qnap-file_station.gemspec
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "qnap-file_station"
|
3
|
-
s.version = "0.0.
|
4
|
-
s.date = "2016-09-28"
|
3
|
+
s.version = "0.0.3"
|
5
4
|
s.summary = "Interface to the File Station API"
|
6
5
|
s.description = "Manage your files and folders in File Station"
|
7
6
|
s.authors = "cyclotron3k"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qnap-file_station
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cyclotron3k
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Manage your files and folders in File Station
|
14
14
|
email:
|