alula-ruby 0.54.0 → 0.55.0
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/.rspec +0 -2
- data/README.md +11 -9
- data/VERSION.md +1 -0
- data/lib/alula/client.rb +1 -1
- data/lib/alula/client_configuration.rb +2 -1
- data/lib/alula/resources/video/base_resource.rb +15 -0
- data/lib/alula/resources/video/device.rb +8 -0
- data/lib/alula/version.rb +1 -1
- data/lib/alula.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c65ba0c26beba1371c3637219cc8e0177f6b2f75d21d74a1f08173f7ddd9ae4
|
4
|
+
data.tar.gz: f53a3c944df2be8b2db9b6c13caddcf919706de53b38f3c18c7d5621bbb3b48e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c63fd1baee26d1c821a2787fd7f2ab26ed76292e11c74b6148a1f567b1c25a282d28509d3cd3ed4e8be9b55b4f89dfd1e4374377588af2c59e87179975678387
|
7
|
+
data.tar.gz: 296cde15d36f05120a947fcaaedaf9f8dfe0f95d60bce233178ff84eca65f2c881ab301bf1830594166b8079e445bc3144afc5f2b5147091193014dbdaee397f
|
data/.rspec
CHANGED
data/README.md
CHANGED
@@ -40,21 +40,23 @@ creds = Alula::Oauth.authenticate(username: "a username", password: "a password"
|
|
40
40
|
```
|
41
41
|
|
42
42
|
## Configuring
|
43
|
-
|
43
|
+
There are two types of settings in the `Alula::Client` configuration:
|
44
|
+
The first one are the ones that will have a fixed value in the application lifecicle so its better to put them in an initializer.
|
44
45
|
```ruby
|
45
|
-
Alula::Client.
|
46
|
-
|
47
|
-
|
46
|
+
Alula::Client.configure do |c|
|
47
|
+
c.api_key = # your API key
|
48
|
+
c.debug = # if set to true will log requests to the API
|
49
|
+
c.user_agent = # A short name for your script/application
|
50
|
+
end
|
48
51
|
```
|
49
|
-
|
52
|
+
The second one are the ones that are stored in the request Rack env, so those need to set on each request (to the application).
|
50
53
|
```ruby
|
51
54
|
Alula::Client.configure do |d|
|
52
|
-
c.api_key = your API key
|
53
|
-
c.
|
54
|
-
c.
|
55
|
+
c.api_key = # your API key
|
56
|
+
c.role = # User/Customer role
|
57
|
+
c.customer_id = # The user_id, optional, only for video API requests
|
55
58
|
end
|
56
59
|
```
|
57
|
-
**Note:** You will also need to add the configuration option `customer_id` to access resources of the video API.
|
58
60
|
|
59
61
|
## Usage
|
60
62
|
|
data/VERSION.md
CHANGED
@@ -86,3 +86,4 @@
|
|
86
86
|
| v0.52.0 | 2022-06-15 | Filter receiver connections based on station id |
|
87
87
|
| v0.53.0 | 2022-06-15 | Filter feature plans on name |
|
88
88
|
| v0.54.0 | 2022-06-21 | Add support for devices from the video API |
|
89
|
+
| v0.55.0 | 2022-06-25 | Add some devices helpers and improves specs |
|
data/lib/alula/client.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Alula
|
2
2
|
class ClientConfiguration
|
3
|
-
|
3
|
+
attr_accessor :api_url, :debug, :user_agent
|
4
|
+
REQUEST_ATTRIBUTES = %i[api_key customer_id]
|
4
5
|
|
5
6
|
# Using RequestStore so we're thread safe even with our non-thread-safe architecture :(
|
6
7
|
REQUEST_ATTRIBUTES.each do |prop|
|
@@ -31,6 +31,21 @@ module Alula
|
|
31
31
|
end
|
32
32
|
|
33
33
|
api_name :video
|
34
|
+
|
35
|
+
def construct_from(json_object)
|
36
|
+
@raw_data = json_object.dup
|
37
|
+
@values = json_object
|
38
|
+
|
39
|
+
self.id = json_object['id'] unless [nil, ''].include?(json_object['id'])
|
40
|
+
|
41
|
+
@dirty_attributes = Set.new
|
42
|
+
@errors = ModelErrors.new(self.class)
|
43
|
+
|
44
|
+
@related_models = {}
|
45
|
+
cache_links(json_object['relationships'] || {})
|
46
|
+
|
47
|
+
self
|
48
|
+
end
|
34
49
|
end
|
35
50
|
end
|
36
51
|
end
|
@@ -11,6 +11,14 @@ module Alula
|
|
11
11
|
field :name, type: :string
|
12
12
|
field :serial_number, type: :string
|
13
13
|
field :verification_code, type: :string
|
14
|
+
|
15
|
+
def is_jsw?
|
16
|
+
manufacturer == 'jsw'
|
17
|
+
end
|
18
|
+
|
19
|
+
def is_hik?
|
20
|
+
manufacturer == 'hikvision'
|
21
|
+
end
|
14
22
|
end
|
15
23
|
end
|
16
24
|
end
|
data/lib/alula/version.rb
CHANGED
data/lib/alula.rb
CHANGED
@@ -130,10 +130,10 @@ module Alula
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def self.logger
|
133
|
-
|
133
|
+
@@logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
134
134
|
end
|
135
135
|
|
136
136
|
def self.logger=(logger)
|
137
|
-
|
137
|
+
@@logger = logger
|
138
138
|
end
|
139
139
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alula-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.55.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Titus Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|