alula-ruby 1.8.1 → 1.9.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/VERSION.md +1 -0
- data/bin/console +37 -1
- data/lib/alula/resources/device.rb +1 -1
- data/lib/alula/resources/device_notification.rb +88 -0
- data/lib/alula/resources/revision.rb +1 -1
- data/lib/alula/resources/user.rb +1 -0
- data/lib/alula/version.rb +1 -1
- data/lib/alula.rb +19 -16
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2d96c37fe6b396ea7da51191870f6cf2fdf2161ba4c584886de23ca13f71286
|
4
|
+
data.tar.gz: 7762865147e3ef70241bfdc8122cde25b0349f516cd264296f0b7c98cb745923
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b7d9e60e505aed16f071afdbaff707ecfd63bcec9e2cd5b537c36b341744406dea9e3ad182a57e88327432069a7d15df6d427b5dd0664d7cad68feb8b6019e6
|
7
|
+
data.tar.gz: 7bd25d2a60a166e68ac1e8cf8daed1928b40260384cf806f7f9c4c12aef543e5187af00eefc613088842d25cd1dcff257d1a2f41e93a1a455d6367d1a9ed03ea
|
data/VERSION.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
| Version | Date | Description |
|
4
4
|
| ------- | --------- | --------------------------------------------------------------------------- |
|
5
|
+
| v1.9.0 | 2024-07-03 | Add DeviceNotification resource with relationships |
|
5
6
|
| v1.8.1 | 2024-06-25 | Update client to accept impersonator authorization to change admin user langauge preference from dealer app |
|
6
7
|
| v1.8.0 | 2024-06-19 | Use Video API endpoints instead of core API passthrough |
|
7
8
|
| v1.7.0 | 2024-06-13 | Add DELETE, PATCH/POST, unregister capabilities for cameras |
|
data/bin/console
CHANGED
@@ -11,5 +11,41 @@ require "dotenv/load"
|
|
11
11
|
# require "pry"
|
12
12
|
# Pry.start
|
13
13
|
|
14
|
-
require
|
14
|
+
require 'irb'
|
15
|
+
|
16
|
+
# setup API
|
17
|
+
def auth_api
|
18
|
+
token = oauth_token
|
19
|
+
raise token if [Alula::Oauth::Error, Alula::RateLimitError].include? token.class
|
20
|
+
|
21
|
+
setup_client(token)
|
22
|
+
puts 'API configured successfully'
|
23
|
+
end
|
24
|
+
|
25
|
+
def setup_oatuh
|
26
|
+
Alula::Oauth.configure(
|
27
|
+
client_id: ENV['ALULA_API_CLIENT_ID'],
|
28
|
+
client_secret: ENV['ALULA_API_CLIENT_SECRET'],
|
29
|
+
api_url: ENV['ALULA_API_DOMAIN']
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def oauth_token
|
34
|
+
setup_oatuh
|
35
|
+
Alula::Oauth.authenticate(
|
36
|
+
grant_type: :client_credentials,
|
37
|
+
scopes: 'rpc:devices.register rpc:devices.assign rest:*'
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
def setup_client(token)
|
42
|
+
Alula::Client.configure do |c|
|
43
|
+
c.api_url = ENV['ALULA_API_DOMAIN']
|
44
|
+
c.api_key = token.access_token
|
45
|
+
c.role = :system
|
46
|
+
c.video_api_url = ENV['VIDEO_API_DOMAIN']
|
47
|
+
c.video_api_key = ENV['VIDEO_API_DOMAIN']
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
15
51
|
IRB.start(__FILE__)
|
@@ -30,7 +30,7 @@ module Alula
|
|
30
30
|
# relationship :eventlog, type: 'devices-eventlog', cardinality: 'To-many'
|
31
31
|
relationship :receiver_group, type: 'receivers-groups', cardinality: 'To-one'
|
32
32
|
# relationship :helix_users, type: 'helix-user', cardinality: 'To-many'
|
33
|
-
|
33
|
+
relationship :notifications, type: 'device-notifications', cardinality: 'To-many'
|
34
34
|
# relationship :users, type: 'devices-user', cardinality: 'To-many'
|
35
35
|
# relationship :features_supported, type: 'devices-features-supported', cardinality: 'To-one'
|
36
36
|
# relationship :features_disabled, type: 'devices-features-disabled', cardinality: 'To-one'
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Alula
|
4
|
+
class DeviceNotification < Alula::RestResource
|
5
|
+
extend Alula::ResourceAttributes
|
6
|
+
extend Alula::RelationshipAttributes
|
7
|
+
extend Alula::ApiOperations::Request
|
8
|
+
extend Alula::ApiOperations::List
|
9
|
+
extend Alula::ApiOperations::Save
|
10
|
+
|
11
|
+
resource_path 'devices/notifications'
|
12
|
+
type 'device-notifications'
|
13
|
+
|
14
|
+
relationship :device, type: 'devices', cardinality: 'To-one'
|
15
|
+
relationship :revisions, type: 'revisions', cardinality: 'To-many'
|
16
|
+
relationship :user, type: 'users', cardinality: 'To-one'
|
17
|
+
|
18
|
+
field :id,
|
19
|
+
type: :string,
|
20
|
+
sortable: false,
|
21
|
+
filterable: false,
|
22
|
+
creatable_by: %i[],
|
23
|
+
patchable_by: %i[]
|
24
|
+
|
25
|
+
field :alarms,
|
26
|
+
type: :array,
|
27
|
+
sortable: false,
|
28
|
+
filterable: false,
|
29
|
+
creatable_by: %i[system station dealer technician user sub_user],
|
30
|
+
patchable_by: %i[system station dealer technician user sub_user]
|
31
|
+
|
32
|
+
field :bypasses_disables,
|
33
|
+
type: :array,
|
34
|
+
sortable: false,
|
35
|
+
filterable: false,
|
36
|
+
creatable_by: %i[system station dealer technician user sub_user],
|
37
|
+
patchable_by: %i[system station dealer technician user sub_user]
|
38
|
+
|
39
|
+
field :device_id,
|
40
|
+
type: :string,
|
41
|
+
sortable: false,
|
42
|
+
filterable: true,
|
43
|
+
creatable_by: %i[system station dealer technician user sub_user],
|
44
|
+
patchable_by: %i[]
|
45
|
+
|
46
|
+
field :i_view_now,
|
47
|
+
type: :array,
|
48
|
+
sortable: false,
|
49
|
+
filterable: false,
|
50
|
+
creatable_by: %i[system station dealer technician user sub_user],
|
51
|
+
patchable_by: %i[system station dealer technician user sub_user]
|
52
|
+
|
53
|
+
field :open_close,
|
54
|
+
type: :array,
|
55
|
+
sortable: false,
|
56
|
+
filterable: false,
|
57
|
+
creatable_by: %i[system station dealer technician user sub_user],
|
58
|
+
patchable_by: %i[system station dealer technician user sub_user]
|
59
|
+
|
60
|
+
field :supervisory,
|
61
|
+
type: :array,
|
62
|
+
sortable: false,
|
63
|
+
filterable: false,
|
64
|
+
creatable_by: %i[system station dealer technician user sub_user],
|
65
|
+
patchable_by: %i[system station dealer technician user sub_user]
|
66
|
+
|
67
|
+
field :test_misc,
|
68
|
+
type: :array,
|
69
|
+
sortable: false,
|
70
|
+
filterable: false,
|
71
|
+
creatable_by: %i[system station dealer technician user sub_user],
|
72
|
+
patchable_by: %i[system station dealer technician user sub_user]
|
73
|
+
|
74
|
+
field :troubles,
|
75
|
+
type: :array,
|
76
|
+
sortable: false,
|
77
|
+
filterable: false,
|
78
|
+
creatable_by: %i[system station dealer technician user sub_user],
|
79
|
+
patchable_by: %i[system station dealer technician user sub_user]
|
80
|
+
|
81
|
+
field :user_id,
|
82
|
+
type: :string,
|
83
|
+
sortable: false,
|
84
|
+
filterable: true,
|
85
|
+
creatable_by: %i[system station dealer technician user sub_user],
|
86
|
+
patchable_by: %i[]
|
87
|
+
end
|
88
|
+
end
|
@@ -13,6 +13,7 @@ module Alula
|
|
13
13
|
# Relationships
|
14
14
|
relationship :creator, type: 'users', cardinality: 'To-one'
|
15
15
|
relationship :device, type: 'devices', cardinality: 'To-one'
|
16
|
+
relationship :device_notification, type: 'device-notifications', cardinality: 'To-one'
|
16
17
|
relationship :user, type: 'users', cardinality: 'To-one'
|
17
18
|
relationship :dealer, type: 'dealers', cardinality: 'To-one'
|
18
19
|
|
@@ -82,7 +83,6 @@ module Alula
|
|
82
83
|
creatable_by: [],
|
83
84
|
patchable_by: []
|
84
85
|
|
85
|
-
|
86
86
|
def document
|
87
87
|
JSON.parse(@values['document'])
|
88
88
|
.with_indifferent_access
|
data/lib/alula/resources/user.rb
CHANGED
@@ -12,6 +12,7 @@ module Alula
|
|
12
12
|
type 'users'
|
13
13
|
|
14
14
|
relationship :devices, type: 'devices', cardinality: 'To-many'
|
15
|
+
relationship :device_notifications, type: 'device-notifications', cardinality: 'To-many'
|
15
16
|
relationship :dealer, type: 'dealers', cardinality: 'To-one'
|
16
17
|
relationship :phone, type: 'users-phones', cardinality: 'To-one'
|
17
18
|
relationship :address, type: 'users-addresses', cardinality: 'To-one'
|
data/lib/alula/version.rb
CHANGED
data/lib/alula.rb
CHANGED
@@ -60,6 +60,7 @@ require_relative 'alula/resources/revision'
|
|
60
60
|
require_relative 'alula/resources/station'
|
61
61
|
require_relative 'alula/resources/oauth_client'
|
62
62
|
require_relative 'alula/resources/device_alias'
|
63
|
+
require_relative 'alula/resources/device_notification'
|
63
64
|
|
64
65
|
require_relative 'alula/resources/feature_plan'
|
65
66
|
require_relative 'alula/resources/feature_planvideo'
|
@@ -106,34 +107,36 @@ module Alula
|
|
106
107
|
# API query responses, and included models.
|
107
108
|
@@resource_map = [
|
108
109
|
Alula::BillingProgram,
|
110
|
+
Alula::Dealer,
|
111
|
+
Alula::DealerAccountTransfer,
|
112
|
+
Alula::DealerBranding,
|
113
|
+
Alula::DealerPhone,
|
114
|
+
Alula::DealerProgram,
|
109
115
|
Alula::Device,
|
110
116
|
Alula::DeviceAlias,
|
111
117
|
Alula::DeviceCharge,
|
112
118
|
Alula::DeviceCredit,
|
113
119
|
Alula::DeviceEventLog,
|
120
|
+
Alula::DeviceNotification,
|
114
121
|
Alula::DeviceProgram,
|
115
122
|
Alula::DealerAddress,
|
116
|
-
Alula::DealerPhone,
|
117
|
-
Alula::DealerProgram,
|
118
123
|
Alula::DeviceCellularStatus,
|
119
|
-
Alula::
|
120
|
-
Alula::User,
|
121
|
-
Alula::UserPhone,
|
122
|
-
Alula::UserAddress,
|
123
|
-
Alula::UserPushtoken,
|
124
|
-
Alula::UserPreferences,
|
125
|
-
Alula::UserVideoProfile,
|
126
|
-
Alula::Dealer,
|
127
|
-
Alula::DealerBranding,
|
128
|
-
Alula::ReceiverGroup,
|
129
|
-
Alula::ReceiverDisabled,
|
130
|
-
Alula::Station,
|
131
|
-
Alula::DealerAccountTransfer,
|
124
|
+
Alula::FeatureBySubject,
|
132
125
|
Alula::FeaturePlan,
|
133
126
|
Alula::FeaturePlanVideo,
|
134
127
|
Alula::FeaturePrice,
|
135
|
-
Alula::FeatureBySubject,
|
136
128
|
Alula::OAuthClient,
|
129
|
+
Alula::ReceiverGroup,
|
130
|
+
Alula::ReceiverDisabled,
|
131
|
+
Alula::Revision,
|
132
|
+
Alula::Self,
|
133
|
+
Alula::Station,
|
134
|
+
Alula::User,
|
135
|
+
Alula::UserAddress,
|
136
|
+
Alula::UserPhone,
|
137
|
+
Alula::UserPreferences,
|
138
|
+
Alula::UserPushtoken,
|
139
|
+
Alula::UserVideoProfile
|
137
140
|
].each_with_object({}) do |klass, resource_map|
|
138
141
|
resource_map[klass.get_type] = klass
|
139
142
|
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: 1.
|
4
|
+
version: 1.9.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: 2024-
|
11
|
+
date: 2024-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -260,6 +260,7 @@ files:
|
|
260
260
|
- lib/alula/resources/device_charge.rb
|
261
261
|
- lib/alula/resources/device_credit.rb
|
262
262
|
- lib/alula/resources/device_event_log.rb
|
263
|
+
- lib/alula/resources/device_notification.rb
|
263
264
|
- lib/alula/resources/device_program.rb
|
264
265
|
- lib/alula/resources/event_trigger.rb
|
265
266
|
- lib/alula/resources/event_webhook.rb
|