passwordstate 0.1.0 → 0.1.1
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/passwordstate/client.rb +8 -1
- data/lib/passwordstate/resource.rb +6 -4
- data/lib/passwordstate/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2548f3e172e66faaa1d3a80f2e366161a61694a1874bffa97e68246d0bfbc091
|
4
|
+
data.tar.gz: 273d810d08aafd3849a42ff5397f4d6e123b1557f33f17590106758ee17773dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c515ecce21af9bdd9e6c72b85041bd979cd23c3d3bb0927c17f665cd7077834a239daaa5f3001a2251d6fa6914e884f39941ab91c9cc33926f9fa194529f84dd
|
7
|
+
data.tar.gz: e087dc037ce713911d626876677a9aacc818261a717a3e867524fb3aece1d4a28f2dde71329c3896fcda2afbde808021b729f3ec7121800e29d5cb5df3fa2500
|
data/lib/passwordstate/client.rb
CHANGED
@@ -11,7 +11,7 @@ module Passwordstate
|
|
11
11
|
}.freeze
|
12
12
|
|
13
13
|
attr_accessor :server_url, :auth_data, :headers, :validate_certificate
|
14
|
-
attr_reader :timeout
|
14
|
+
attr_reader :open_timeout, :timeout
|
15
15
|
attr_writer :api_type
|
16
16
|
|
17
17
|
def initialize(url, options = {})
|
@@ -20,6 +20,7 @@ module Passwordstate
|
|
20
20
|
@headers = DEFAULT_HEADERS
|
21
21
|
@auth_data = options.select { |k, _v| %i[apikey username password].include? k }
|
22
22
|
@api_type = options.fetch(:api_type) if options.key? :api_type
|
23
|
+
@open_timeout = options.fetch(:open_timeout, 5)
|
23
24
|
@timeout = options.fetch(:timeout, 15)
|
24
25
|
end
|
25
26
|
|
@@ -31,6 +32,11 @@ module Passwordstate
|
|
31
32
|
@api_type || (auth_data.key?(:apikey) ? :api : :winapi)
|
32
33
|
end
|
33
34
|
|
35
|
+
def open_timeout=(sec)
|
36
|
+
@open_timeout = sec
|
37
|
+
@http.open_timeout = sec if @http
|
38
|
+
end
|
39
|
+
|
34
40
|
def timeout=(sec)
|
35
41
|
@timeout = sec
|
36
42
|
@http.read_timeout = sec if @http
|
@@ -155,6 +161,7 @@ module Passwordstate
|
|
155
161
|
@http ||= Net::HTTP.new server_url.host, server_url.port
|
156
162
|
return @http if @http.active?
|
157
163
|
|
164
|
+
@http.open_timeout = @open_timeout if @open_timeout
|
158
165
|
@http.read_timeout = @timeout if @timeout
|
159
166
|
@http.use_ssl = server_url.scheme == 'https'
|
160
167
|
@http.verify_mode = validate_certificate ? ::OpenSSL::SSL::VERIFY_NONE : nil
|
@@ -151,6 +151,12 @@ module Passwordstate
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
+
def modified?(field = nil)
|
155
|
+
return modified.any? unless field
|
156
|
+
|
157
|
+
modified.include? field
|
158
|
+
end
|
159
|
+
|
154
160
|
protected
|
155
161
|
|
156
162
|
def api_path
|
@@ -162,10 +168,6 @@ module Passwordstate
|
|
162
168
|
attribs.reject { |field| old[field] == attribs[field] }
|
163
169
|
end
|
164
170
|
|
165
|
-
def modified?(field)
|
166
|
-
modified.include? field
|
167
|
-
end
|
168
|
-
|
169
171
|
def old
|
170
172
|
@old ||= attributes.dup
|
171
173
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passwordstate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Olofsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
190
|
requirements: []
|
191
|
-
rubygems_version: 3.3
|
191
|
+
rubygems_version: 3.5.3
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: A ruby API client for interacting with a passwordstate server
|