qnap-file_station 0.0.4 → 0.0.5

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
- SHA1:
3
- metadata.gz: b7b6ede6e731c28529b06f66fb3f540c74ba51c1
4
- data.tar.gz: 78a98a04f25f4704ac241831c0ecc22a26217ee4
2
+ SHA256:
3
+ metadata.gz: 51d0d62f125fe53487b2f41105b2d7be9de64d714d3e73dc2e552fdd77e649f9
4
+ data.tar.gz: 1004c7e7cf5d3ab18f43e35cc6e823405187e3b176825744db980dbe9c4b47cd
5
5
  SHA512:
6
- metadata.gz: b44c4e7a3b33c78d3b48b451e49a3249a62928ae4c825a2e7bdd5317d2804cdac483887e4f34462ebfe041e6e0be57cd87c601aefec6a43067c86b2031e03302
7
- data.tar.gz: 498130c57a0ee5baa59be4a46cae3aee1e2e94b46c0aa6c97342d6de70be3c65e191e31ad60188b1574dab8e2a501f3d6ba80c3ff840f4e6b1f2a43c99ed09ef
6
+ metadata.gz: 400e3bdd7f6778cfbbc9ded4c4a318de1bfbfc9220e2e616e494bed74f4eac171f371c170931f5b2450c13c49703be746f49594aa84693234e3237552fd66c9b
7
+ data.tar.gz: d062efdbc681e3e9a4ada5052a0f6815a0dbe7b3754fd8e39888407188b9c8df1a59ec7414b97458ef13626574fa257fec8eee79d890702feadc7729ae1a9b4f
data/README.md CHANGED
@@ -39,6 +39,21 @@ end
39
39
 
40
40
  ```
41
41
 
42
+ Alternatively, if the username and password are not provided, Qnap::FileStation will attempt to read them from environment variables.
43
+ ```ruby
44
+ # ENV['QNAP_USERNAME']
45
+ # ENV['QNAP_PASSWORD']
46
+
47
+ fs = Qnap::FileStation.new '192.168.1.100'
48
+ # ...
49
+ fs.logout
50
+
51
+ # or...
52
+ Qnap::FileStation.session('192.168.1.100') do |fs|
53
+ # ...
54
+ end
55
+ ```
56
+
42
57
  Constants
43
58
  -------
44
59
  `Qnap::FileStation::DEBUG`, default: `false`. Print extensive debugging information to `$stdout` if `true`
@@ -290,7 +305,7 @@ path | Folder path.
290
305
  file_total | Total number of folder/file(s).
291
306
  file_name | Folder/file name.
292
307
 
293
- ### stat
308
+ ### stat
294
309
  Set folder(s)/file(s) modification time.
295
310
 
296
311
  #### Parameters
@@ -316,7 +331,7 @@ limit | Number of response data
316
331
  sort | Sort field (filename/filesize/filetype/mt/privilege/owner/group)
317
332
  start | Response data start index
318
333
 
319
- ###
334
+ ###
320
335
  Download a shared file by an unique ID (ssid).
321
336
 
322
337
  #### Parameters
@@ -463,7 +478,7 @@ Show available network players (AirPlay, Chromecast, DLNA players, etc.) May not
463
478
  #### Parameters
464
479
  Key | Description
465
480
  --- | ---
466
- op | 1:
481
+ op | 1:
467
482
 
468
483
  ### video_ml_queue
469
484
  Retrieve the status of media library transcoding queue.
@@ -103,7 +103,11 @@ module Qnap
103
103
  @sid ||= login(user: @username, pwd: Base64.encode64(@password).strip)[:sid]
104
104
  end
105
105
 
106
- def initialize(host, username, password)
106
+ def initialize(host, username = ENV['QNAP_USERNAME'], password = ENV['QNAP_PASSWORD'])
107
+
108
+ raise ArgumentError.new("No username defined") if username.nil?
109
+ raise ArgumentError.new("No password defined") if password.nil?
110
+
107
111
  @host = host
108
112
  @username = username
109
113
  @password = password
@@ -111,7 +115,7 @@ module Qnap
111
115
  @base_uri = URI "#{PROTOCOL}://#{@host}"
112
116
  @path = "/cgi-bin/filemanager/utilRequest.cgi"
113
117
  @agent = Net::HTTP.new @base_uri.host, @base_uri.port
114
-
118
+
115
119
  @agent.use_ssl = PROTOCOL == 'https',
116
120
  @agent.verify_mode = OpenSSL::SSL::VERIFY_NONE
117
121
  @agent.keep_alive_timeout = 10
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "qnap-file_station"
3
- s.version = "0.0.4"
3
+ s.version = "0.0.5"
4
4
  s.summary = "Interface to the File Station API"
5
5
  s.description = "Manage your files and folders in File Station"
6
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
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - cyclotron3k
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-01 00:00:00.000000000 Z
11
+ date: 2019-06-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Manage your files and folders in File Station
14
14
  email:
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  version: '0'
43
43
  requirements: []
44
44
  rubyforge_project:
45
- rubygems_version: 2.5.1
45
+ rubygems_version: 2.7.6.2
46
46
  signing_key:
47
47
  specification_version: 4
48
48
  summary: Interface to the File Station API