alula-ruby 0.57.0 → 0.60.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: 74c4d19ef1d5c29584d0cc44323a1fbf63fe80d5ab6eacfc09c78f1316511caf
4
- data.tar.gz: ba207cd8c9f29e07a564c561da49e36650d98ff19ee043bbcfbe4e468b181481
3
+ metadata.gz: e9a76cd63fcee6932ae7741e92ed420b1df70c8f1241a96fe86b6cd0fdb44062
4
+ data.tar.gz: aeb4be51fd8ea443e31893791a68528110f9b3044a95f80c0c242dca3a0df179
5
5
  SHA512:
6
- metadata.gz: a702cb33c8448b1be68e4b5046fb7b54f878b8d1b23bb77db03953e3a785d43bfc054f10895c6a63bb2c45aa02a5bbd1b24ba90a625a4cf7510417ffb3e39f1b
7
- data.tar.gz: d1095d24d4c0cf1de9297ea32c796b1edc6f9df0bd1165cae6a4bc890f06ebb3e08a560a75292b28613d385990d1bcf409f438593dff1aafce132acec3ac3c26
6
+ metadata.gz: f19af99762ca90639aa4fc7a61794362bae766c9916c1b0be94535eeb6708ad8d3396a06f2693d799a3f57fd61c1518116f19087fb11b2ca73141c9751aa85a1
7
+ data.tar.gz: dda5c947375997cb8e1bc6456e67eea96f60976e83c87e83e8dbfd35e4aa0aba0d020b2ca6efec3ae3ded6b264e1fc8ef8b60c93b1e750505cfa53de1974f12f
data/VERSION.md CHANGED
@@ -89,3 +89,6 @@
89
89
  | v0.55.0 | 2022-06-25 | Add some devices helpers and improves specs |
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
+ | 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 |
@@ -19,6 +19,10 @@ module Alula
19
19
  )
20
20
  end
21
21
 
22
+ def clone
23
+ self.class.new(nil, @raw_data['attributes'])
24
+ end
25
+
22
26
  #
23
27
  # Construct a new resource, ready to receive attributes, with
24
28
  # empty values for all attrs.
@@ -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
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.57.0'
4
+ VERSION = '0.60.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'
@@ -74,6 +75,7 @@ require_relative 'alula/procedures/device_unassign_proc'
74
75
  require_relative 'alula/procedures/device_signal_add_proc'
75
76
  require_relative 'alula/procedures/device_signal_update_proc'
76
77
  require_relative 'alula/procedures/device_signal_delivered_proc'
78
+ require_relative 'alula/procedures/feature_plan_clone_proc'
77
79
  require_relative 'alula/procedures/dealer_device_stats_proc'
78
80
  require_relative 'alula/procedures/dealer_suspend_proc'
79
81
  require_relative 'alula/procedures/dealer_restore_proc'
@@ -98,6 +100,7 @@ module Alula
98
100
  Alula::BillingProgram,
99
101
  Alula::Device,
100
102
  Alula::DeviceCharge,
103
+ Alula::DeviceCredit,
101
104
  Alula::DeviceEventLog,
102
105
  Alula::DeviceProgram,
103
106
  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.57.0
4
+ version: 0.60.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-20 00:00:00.000000000 Z
11
+ date: 2022-08-17 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
@@ -245,6 +246,7 @@ files:
245
246
  - lib/alula/resources/device.rb
246
247
  - lib/alula/resources/device_cellular_status.rb
247
248
  - lib/alula/resources/device_charge.rb
249
+ - lib/alula/resources/device_credit.rb
248
250
  - lib/alula/resources/device_event_log.rb
249
251
  - lib/alula/resources/device_program.rb
250
252
  - lib/alula/resources/event_trigger.rb