alula-ruby 0.60.0 → 0.63.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9a76cd63fcee6932ae7741e92ed420b1df70c8f1241a96fe86b6cd0fdb44062
4
- data.tar.gz: aeb4be51fd8ea443e31893791a68528110f9b3044a95f80c0c242dca3a0df179
3
+ metadata.gz: 68997cffff2b1c812ddd7779ee67edeb9e4f6bb757a35aa730c07e04a2ef292c
4
+ data.tar.gz: 20d72663270fee299101dad0294d00eb00e7f597b0b30dc97e9b1c8be784624e
5
5
  SHA512:
6
- metadata.gz: f19af99762ca90639aa4fc7a61794362bae766c9916c1b0be94535eeb6708ad8d3396a06f2693d799a3f57fd61c1518116f19087fb11b2ca73141c9751aa85a1
7
- data.tar.gz: dda5c947375997cb8e1bc6456e67eea96f60976e83c87e83e8dbfd35e4aa0aba0d020b2ca6efec3ae3ded6b264e1fc8ef8b60c93b1e750505cfa53de1974f12f
6
+ metadata.gz: 111ed8421262c32b0d2ae6d1f1794a0daef1a0fc2235a2436340945e3d8cd56494b3195cec19eb9770969a98ea77da60e997b47dbe50c46f50c642aa0f37fd2b
7
+ data.tar.gz: c47f8d2f605516a60a1f5e762973edfec2827c611175ed09b402f2e3cc359e8191bd6084a858302a638a608a5b03a1f5a34c0bbedd1abab0acc2d411d8465474
data/VERSION.md CHANGED
@@ -92,3 +92,6 @@
92
92
  | v0.58.0 | 2022-07-21 | Add clone method, that creates a copy of a resource |
93
93
  | v0.59.0 | 2022-08-10 | Add clone RPC method for Feature Plans |
94
94
  | v0.60.0 | 2022-08-16 | Add Device Credits resource |
95
+ | v0.61.0 | 2022-08-19 | User hidden resource |
96
+ | v0.62.0 | 2022-08-19 | Remove Admin User resource map |
97
+ | v0.63.0 | 2022-08-25 | Gateway Error |
data/lib/alula/errors.rb CHANGED
@@ -26,6 +26,9 @@ module Alula
26
26
 
27
27
  elsif response.data.match(/^<!DOCTYPE html>/)
28
28
  self.critical_error_for_response(response.data.scan(/<pre>(.*)<\/pre>/))
29
+
30
+ elsif response.data.match(/502 Bad Gateway/)
31
+ self.gateway_error_for_response(response.data.scan(/502 Bad Gateway/))
29
32
  else
30
33
  message = "Unable to derive error from response: #{response.inspect}"
31
34
  Alula.logger.error message
@@ -45,6 +48,11 @@ module Alula
45
48
  InvalidRequestError.new(error_text.first.first)
46
49
  end
47
50
 
51
+ # Handle Gateway errors from the API
52
+ def self.gateway_error_for_response(error_text)
53
+ ApiGatewayError.new(error_text.first)
54
+ end
55
+
48
56
  # Figure out what error should be raised
49
57
  def self.error_for_response(response)
50
58
  case response.data['error']
@@ -101,6 +109,9 @@ module Alula
101
109
  class UnknownApiError < AlulaError
102
110
  end
103
111
 
112
+ class ApiGatewayError < AlulaError
113
+ end
114
+
104
115
  class RateLimitError < AlulaError
105
116
  end
106
117
 
@@ -198,6 +198,17 @@ module Alula
198
198
  creatable_by: %i[system station dealer technician user],
199
199
  patchable_by: %i[system station dealer technician user sub_user]
200
200
 
201
+ field :hidden,
202
+ type: :string,
203
+ sortable: false,
204
+ filterable: true,
205
+ creatable_by: [],
206
+ patchable_by: %i[system]
207
+
208
+ def hidden?
209
+ hidden == '1'
210
+ end
211
+
201
212
  def user_role
202
213
  # pre-alula api users will be u_type 32, newer ones are 96. need to differentiate
203
214
  # between account users and account owners by checking if they own themselves
data/lib/alula/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alula
4
- VERSION = '0.60.0'
4
+ VERSION = '0.63.0'
5
5
  end
data/lib/alula.rb CHANGED
@@ -44,7 +44,6 @@ require_relative 'alula/resources/event_trigger'
44
44
  require_relative 'alula/resources/event_webhook'
45
45
  require_relative 'alula/resources/self'
46
46
  require_relative 'alula/resources/user'
47
- require_relative 'alula/resources/admin_user'
48
47
  require_relative 'alula/resources/user_phone'
49
48
  require_relative 'alula/resources/user_address'
50
49
  require_relative 'alula/resources/user_pushtoken'
@@ -108,7 +107,6 @@ module Alula
108
107
  Alula::DeviceCellularStatus,
109
108
  Alula::Self,
110
109
  Alula::User,
111
- Alula::AdminUser,
112
110
  Alula::UserPhone,
113
111
  Alula::UserAddress,
114
112
  Alula::UserPushtoken,
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.60.0
4
+ version: 0.63.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-08-17 00:00:00.000000000 Z
11
+ date: 2022-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -235,7 +235,6 @@ files:
235
235
  - lib/alula/rate_limit.rb
236
236
  - lib/alula/relationship_attributes.rb
237
237
  - lib/alula/resource_attributes.rb
238
- - lib/alula/resources/admin_user.rb
239
238
  - lib/alula/resources/billing_program.rb
240
239
  - lib/alula/resources/dealer.rb
241
240
  - lib/alula/resources/dealer_account_transfer.rb
@@ -1,207 +0,0 @@
1
- module Alula
2
- class AdminUser < Alula::User
3
- extend Alula::ResourceAttributes
4
- extend Alula::RelationshipAttributes
5
- extend Alula::ApiOperations::Request
6
- extend Alula::ApiOperations::List
7
- extend Alula::ApiOperations::Save
8
-
9
- resource_path 'admins/users'
10
- type 'admins-users'
11
-
12
- relationship :devices, type: 'devices', cardinality: 'To-many'
13
- relationship :dealer, type: 'dealers', cardinality: 'To-one'
14
- relationship :phone, type: 'users-phones', cardinality: 'To-one'
15
- relationship :address, type: 'users-addresses', cardinality: 'To-one'
16
- relationship :pushtokens, type: 'users-pushtokens', cardinality: 'To-many'
17
- relationship :preferences, type: 'users-preferences', cardinality: 'To-one'
18
- relationship :videoprofiles, type: 'users-videoprofiles', cardinality: 'To-many'
19
-
20
- # Resource Fields
21
- # Not all params are used at the moment. See Alula::ResourceAttributes for details
22
- # on how params are parsed,
23
- field :id,
24
- type: :string,
25
- sortable: false,
26
- filterable: false,
27
- creatable_by: [],
28
- patchable_by: []
29
-
30
- field :username,
31
- type: :string,
32
- sortable: true,
33
- filterable: true,
34
- creatable_by: [:system, :station, :dealer, :technician, :user],
35
- patchable_by: [:system, :station, :dealer, :technician, :user, :sub_user]
36
-
37
- field :password,
38
- type: :string,
39
- sortable: false,
40
- filterable: false,
41
- creatable_by: [:system, :station, :dealer, :technician, :user],
42
- patchable_by: []
43
-
44
- field :u_type,
45
- type: :string,
46
- sortable: false,
47
- filterable: true,
48
- creatable_by: [:system, :station, :dealer, :technician, :user],
49
- patchable_by: []
50
-
51
- field :user_type,
52
- type: :string,
53
- sortable: false,
54
- filterable: true,
55
- creatable_by: [:system, :station, :dealer, :technician, :user],
56
- patchable_by: [],
57
- symbolize: true
58
-
59
- field :u_level,
60
- type: :string,
61
- sortable: false,
62
- filterable: false,
63
- creatable_by: [],
64
- patchable_by: []
65
-
66
- field :parent_id,
67
- type: :string,
68
- sortable: false,
69
- filterable: true,
70
- creatable_by: [:system, :station, :dealer, :technician, :user],
71
- patchable_by: []
72
-
73
- field :dealer_id,
74
- type: :string,
75
- sortable: false,
76
- filterable: true,
77
- creatable_by: [:system, :station, :dealer, :technician, :user],
78
- patchable_by: []
79
-
80
- field :station_id,
81
- type: :string,
82
- sortable: false,
83
- filterable: true,
84
- creatable_by: [],
85
- patchable_by: []
86
-
87
- field :last_login,
88
- type: :string,
89
- sortable: false,
90
- filterable: false,
91
- creatable_by: [],
92
- patchable_by: []
93
-
94
- field :date_entered,
95
- type: :date,
96
- sortable: true,
97
- filterable: true,
98
- creatable_by: [],
99
- patchable_by: []
100
-
101
- field :date_modified,
102
- type: :date,
103
- sortable: true,
104
- filterable: true,
105
- creatable_by: [],
106
- patchable_by: []
107
-
108
- field :entered_by,
109
- type: :string,
110
- sortable: false,
111
- filterable: false,
112
- creatable_by: [],
113
- patchable_by: []
114
-
115
- field :modified_by,
116
- type: :string,
117
- sortable: false,
118
- filterable: false,
119
- creatable_by: [],
120
- patchable_by: []
121
-
122
- field :pwch,
123
- type: :string,
124
- sortable: false,
125
- filterable: false,
126
- creatable_by: [],
127
- patchable_by: []
128
-
129
- field :features_selected,
130
- type: :object,
131
- sortable: false,
132
- filterable: false,
133
- creatable_by: [:system, :station, :dealer, :technician],
134
- patchable_by: [:system, :station, :dealer, :technician]
135
-
136
- field :eula,
137
- type: :string,
138
- sortable: false,
139
- filterable: false,
140
- creatable_by: [],
141
- patchable_by: [:system, :station, :dealer, :technician, :user, :sub_user]
142
-
143
- field :def_mod,
144
- type: :string,
145
- sortable: false,
146
- filterable: false,
147
- creatable_by: [],
148
- patchable_by: []
149
-
150
- field :rg_activated,
151
- type: :string,
152
- sortable: false,
153
- filterable: false,
154
- creatable_by: [],
155
- patchable_by: []
156
-
157
- field :company_name,
158
- type: :string,
159
- sortable: false,
160
- filterable: false,
161
- creatable_by: [],
162
- patchable_by: []
163
-
164
- field :name_first,
165
- type: :string,
166
- sortable: true,
167
- filterable: true,
168
- creatable_by: [:system, :station, :dealer, :technician, :user],
169
- patchable_by: [:system, :station, :dealer, :technician, :user, :sub_user]
170
-
171
- field :name_last,
172
- type: :string,
173
- sortable: true,
174
- filterable: true,
175
- creatable_by: [:system, :station, :dealer, :technician, :user],
176
- patchable_by: [:system, :station, :dealer, :technician, :user, :sub_user]
177
-
178
- field :email,
179
- type: :string,
180
- sortable: true,
181
- filterable: true,
182
- creatable_by: [:system, :station, :dealer, :technician, :user],
183
- patchable_by: [:system, :station, :dealer, :technician, :user, :sub_user]
184
-
185
- field :time_offset,
186
- type: :string,
187
- sortable: false,
188
- filterable: false,
189
- creatable_by: [],
190
- patchable_by: []
191
-
192
- field :timezone,
193
- type: :string,
194
- sortable: false,
195
- filterable: false,
196
- creatable_by: [:system, :station, :dealer, :technician, :user],
197
- patchable_by: [:system, :station, :dealer, :technician, :user, :sub_user]
198
-
199
- field :hidden,
200
- type: :boolean,
201
- sortable: true,
202
- filterable: true,
203
- creatable_by: [:system],
204
- patchable_by: [:system]
205
-
206
- end
207
- end