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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b53bdac66bf563c2314cdad578479e57b1c621b
4
- data.tar.gz: eba64d3cf0bec2d666fd2d43ce771317e327cb2e
3
+ metadata.gz: a5b17e28b82aa0b9bd84caad5770597a5c2583cf
4
+ data.tar.gz: f32a9a1d6fb8b94567858240380a09e6f451346c
5
5
  SHA512:
6
- metadata.gz: 7e6c546e57b12b145e6101f97e69bc7f6509f886baff56c6add067a2996fc5ceddeba238c43e08acdb405b74441b2102611c0c9d24fad90805a8449bf895ab42
7
- data.tar.gz: a080dea3bfb8c1868a7cd722234dfa91997c447d353dea539a94e182cb369bfb3ffcce7487c85fc9989bc04246c8dde09b20aa1ebc63708adee31a76d89aa9e7
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 @stdout of `true`
45
- `Qnap::FileStation::DISCARD_EXTRANEOUS` default: `true`, Discard any parameters we're not expecting, before despatching to the API
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 `the response` method will return the `Net::HTTPResponse` response
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
@@ -137,12 +137,15 @@ module Qnap
137
137
  raise "Error response from #{uri} -> #{response.read_body}"
138
138
  end
139
139
 
140
- unless response['content-type'] =~ /application\/json/
141
- raise "Don't know how to parse #{response['content-type']}"
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
@@ -1,7 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "qnap-file_station"
3
- s.version = "0.0.2"
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.2
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: 2016-09-28 00:00:00.000000000 Z
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: