alula-ruby 0.58.0 → 0.61.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: 911939bc3e4bcf671c33629537486291a1b1788a352ba80b7dae91fcab553eec
4
- data.tar.gz: 857657d8eaef5dd34c922e47bfeeb722d356d90b6177b290c0453615719f4b0b
3
+ metadata.gz: d1ede6cdbfb53c529ab1304e84f394710e6992929620377bf3195aed80a1bc56
4
+ data.tar.gz: 942d3e61791f29b62f3b6129dfcbc71ec62718204db7fd3ae2763660bbbdbd31
5
5
  SHA512:
6
- metadata.gz: ac1d5c2a78d373c258d4cfae8428ce9717c099ff9ebef5e8553c4655b50b86de394c5e3bd5fc92eda605e58f3dade181e1faf1130f325f00b4ff568814b0ab8d
7
- data.tar.gz: 8393d161bd94feb80e86ab313b1bd58bbb8b43f53cca057c0ea679ed137a33fe1dcc7cd3b1fe827fc41b5c5e75212aad95a42346b964561f8f61ae6386bf86bb
6
+ metadata.gz: 1d8bc08cee3bd717877b0816d4d21007ac34439ba6b64264f263bcc82889a95c0bdc7bc3e2cb334b530474d01337c4e58663311acf0a3d57d39a06a68e2a6f18
7
+ data.tar.gz: 62b5b93a4de3d71a4ab0f0df03798e0a0b526149f18bdf5822532bc593da6f1f5c9e6bff03e3c8908d5eeb01bfecdc5651ddd2cd943e064c24868e5cb7bf3eb0
data/VERSION.md CHANGED
@@ -90,3 +90,6 @@
90
90
  | v0.56.0 | 2022-07-08 | Add save! that raises an exception |
91
91
  | v0.57.0 | 2022-07-19 | Add Alula Messenger to device object |
92
92
  | v0.58.0 | 2022-07-21 | Add clone method, that creates a copy of a resource |
93
+ | v0.59.0 | 2022-08-10 | Add clone RPC method for Feature Plans |
94
+ | v0.60.0 | 2022-08-16 | Add Device Credits resource |
95
+ | v0.61.0 | 2022-08-19 | User hidden resource |
@@ -0,0 +1,48 @@
1
+ ##
2
+ # source_gp_id string The source feature id
3
+ # new_gp_id string New feature id
4
+ # name string New Feature Plan name
5
+ # description boolean New Feature Plan description
6
+ #
7
+
8
+ # Method: featurePlans.clone
9
+ module Alula
10
+ class FeaturePlanCloneProc < Alula::RpcResource
11
+
12
+ class Response < Alula::RpcResponse
13
+ def initialize(response)
14
+ super(response)
15
+ #
16
+ # This RPC response gives a new FeaturePlan item
17
+ data = response.data['result'][0]
18
+ attributes = {
19
+ id: data['id'],
20
+ gp_id: data['gp_id'],
21
+ name: data['name'],
22
+ description: data['description'],
23
+ }
24
+ @data = Alula::FeaturePlan.new(data['id'], attributes)
25
+ end
26
+
27
+ def ok?
28
+ @result.is_a?(Array) || (@result['errors'].nil? && @result['error'].nil?)
29
+ end
30
+ end
31
+
32
+ def self.call(source_gp_id:, new_gp_id:, name:, description: "")
33
+ payload = {
34
+ sourceGpId: source_gp_id,
35
+ newGpId: new_gp_id,
36
+ name: name,
37
+ description: description
38
+ }
39
+
40
+ request(
41
+ http_method: :post,
42
+ path: '/rpc/v1/features/clone',
43
+ payload: payload,
44
+ handler: Response
45
+ )
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,70 @@
1
+ module Alula
2
+ class DeviceCredit < Alula::RestResource
3
+ extend Alula::ResourceAttributes
4
+ extend Alula::ApiOperations::Request
5
+ extend Alula::ApiOperations::List
6
+ extend Alula::ApiOperations::Save
7
+
8
+ resource_path 'devices/credits'
9
+ type 'devices-credit'
10
+
11
+ # Resource Fields
12
+ # Not all params are used at the moment. See Alula::ResourceAttributes for details
13
+ # on how params are parsed,
14
+ field :id,
15
+ type: :string,
16
+ sortable: true,
17
+ filterable: true,
18
+ creatable_by: [],
19
+ patchable_by: []
20
+
21
+ field :device_id,
22
+ type: :string,
23
+ sortable: true,
24
+ filterable: true,
25
+ creatable_by: [:system],
26
+ patchable_by: []
27
+
28
+ field :credit_type,
29
+ type: :string,
30
+ sortable: true,
31
+ filterable: true,
32
+ creatable_by: [:system],
33
+ patchable_by: []
34
+
35
+ field :initial_amount,
36
+ type: :number,
37
+ sortable: true,
38
+ filterable: false,
39
+ creatable_by: [:system],
40
+ patchable_by: [:system]
41
+
42
+ field :used_amount,
43
+ type: :number,
44
+ sortable: true,
45
+ filterable: false,
46
+ creatable_by: [],
47
+ patchable_by: [:system]
48
+
49
+ field :date_modified,
50
+ type: :date,
51
+ sortable: true,
52
+ filterable: false,
53
+ creatable_by: [],
54
+ patchable_by: []
55
+
56
+ field :date_created,
57
+ type: :date,
58
+ sortable: true,
59
+ filterable: false,
60
+ creatable_by: [],
61
+ patchable_by: []
62
+
63
+ field :expiration_date,
64
+ type: :date,
65
+ sortable: true,
66
+ filterable: false,
67
+ creatable_by: [:system],
68
+ patchable_by: [:system]
69
+ end
70
+ end
@@ -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.58.0'
4
+ VERSION = '0.61.0'
5
5
  end
data/lib/alula.rb CHANGED
@@ -32,6 +32,7 @@ require_relative 'alula/helpers/device_attribute_translations'
32
32
  require_relative 'alula/resources/billing_program'
33
33
  require_relative 'alula/resources/device'
34
34
  require_relative 'alula/resources/device_charge'
35
+ require_relative 'alula/resources/device_credit'
35
36
  require_relative 'alula/resources/device_event_log'
36
37
  require_relative 'alula/resources/device_cellular_status'
37
38
  require_relative 'alula/resources/device_program'
@@ -43,7 +44,6 @@ require_relative 'alula/resources/event_trigger'
43
44
  require_relative 'alula/resources/event_webhook'
44
45
  require_relative 'alula/resources/self'
45
46
  require_relative 'alula/resources/user'
46
- require_relative 'alula/resources/admin_user'
47
47
  require_relative 'alula/resources/user_phone'
48
48
  require_relative 'alula/resources/user_address'
49
49
  require_relative 'alula/resources/user_pushtoken'
@@ -74,6 +74,7 @@ require_relative 'alula/procedures/device_unassign_proc'
74
74
  require_relative 'alula/procedures/device_signal_add_proc'
75
75
  require_relative 'alula/procedures/device_signal_update_proc'
76
76
  require_relative 'alula/procedures/device_signal_delivered_proc'
77
+ require_relative 'alula/procedures/feature_plan_clone_proc'
77
78
  require_relative 'alula/procedures/dealer_device_stats_proc'
78
79
  require_relative 'alula/procedures/dealer_suspend_proc'
79
80
  require_relative 'alula/procedures/dealer_restore_proc'
@@ -98,6 +99,7 @@ module Alula
98
99
  Alula::BillingProgram,
99
100
  Alula::Device,
100
101
  Alula::DeviceCharge,
102
+ Alula::DeviceCredit,
101
103
  Alula::DeviceEventLog,
102
104
  Alula::DeviceProgram,
103
105
  Alula::DealerAddress,
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.58.0
4
+ version: 0.61.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-07-22 00:00:00.000000000 Z
11
+ date: 2022-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -222,6 +222,7 @@ files:
222
222
  - lib/alula/procedures/device_signal_update_proc.rb
223
223
  - lib/alula/procedures/device_unassign_proc.rb
224
224
  - lib/alula/procedures/device_unregister_proc.rb
225
+ - lib/alula/procedures/feature_plan_clone_proc.rb
225
226
  - lib/alula/procedures/upload_touchpad_branding_proc.rb
226
227
  - lib/alula/procedures/user_plansvideo_price_get.rb
227
228
  - lib/alula/procedures/user_transfer_accept.rb
@@ -234,7 +235,6 @@ files:
234
235
  - lib/alula/rate_limit.rb
235
236
  - lib/alula/relationship_attributes.rb
236
237
  - lib/alula/resource_attributes.rb
237
- - lib/alula/resources/admin_user.rb
238
238
  - lib/alula/resources/billing_program.rb
239
239
  - lib/alula/resources/dealer.rb
240
240
  - lib/alula/resources/dealer_account_transfer.rb
@@ -245,6 +245,7 @@ files:
245
245
  - lib/alula/resources/device.rb
246
246
  - lib/alula/resources/device_cellular_status.rb
247
247
  - lib/alula/resources/device_charge.rb
248
+ - lib/alula/resources/device_credit.rb
248
249
  - lib/alula/resources/device_event_log.rb
249
250
  - lib/alula/resources/device_program.rb
250
251
  - lib/alula/resources/event_trigger.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