alula-ruby 0.50.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +14 -0
- data/.env.example +8 -0
- data/.github/workflows/gem-push.yml +45 -0
- data/.gitignore +23 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Dockerfile +6 -0
- data/Gemfile +12 -0
- data/Guardfile +42 -0
- data/README.md +423 -0
- data/Rakefile +6 -0
- data/VERSION.md +84 -0
- data/alula-docker-compose.yml +80 -0
- data/alula.gemspec +38 -0
- data/bin/console +15 -0
- data/bin/docparse +36 -0
- data/bin/genresource +79 -0
- data/bin/setup +8 -0
- data/bin/testauth +24 -0
- data/bin/testprep +9 -0
- data/data/docs/Alula_API_Documentation_2021-04-06.html +16240 -0
- data/docker-compose.yml +11 -0
- data/lib/alula/alula_response.rb +20 -0
- data/lib/alula/api_operations/delete.rb +52 -0
- data/lib/alula/api_operations/list.rb +45 -0
- data/lib/alula/api_operations/request.rb +44 -0
- data/lib/alula/api_operations/save.rb +81 -0
- data/lib/alula/api_resource.rb +196 -0
- data/lib/alula/client.rb +142 -0
- data/lib/alula/errors.rb +169 -0
- data/lib/alula/filter_builder.rb +271 -0
- data/lib/alula/helpers/device_attribute_translations.rb +68 -0
- data/lib/alula/list_object.rb +64 -0
- data/lib/alula/meta.rb +16 -0
- data/lib/alula/monkey_patches.rb +24 -0
- data/lib/alula/oauth.rb +118 -0
- data/lib/alula/pagination.rb +25 -0
- data/lib/alula/procedures/dealer_device_stats_proc.rb +16 -0
- data/lib/alula/procedures/dealer_restore_proc.rb +25 -0
- data/lib/alula/procedures/dealer_suspend_proc.rb +25 -0
- data/lib/alula/procedures/device_assign_proc.rb +23 -0
- data/lib/alula/procedures/device_cellular_history_proc.rb +33 -0
- data/lib/alula/procedures/device_rateplan_get_proc.rb +21 -0
- data/lib/alula/procedures/device_register_proc.rb +31 -0
- data/lib/alula/procedures/device_signal_add_proc.rb +42 -0
- data/lib/alula/procedures/device_signal_delivered_proc.rb +31 -0
- data/lib/alula/procedures/device_signal_update_proc.rb +32 -0
- data/lib/alula/procedures/device_unassign_proc.rb +16 -0
- data/lib/alula/procedures/device_unregister_proc.rb +21 -0
- data/lib/alula/procedures/upload_touchpad_branding_proc.rb +24 -0
- data/lib/alula/procedures/user_plansvideo_price_get.rb +21 -0
- data/lib/alula/procedures/user_transfer_accept.rb +19 -0
- data/lib/alula/procedures/user_transfer_authorize.rb +18 -0
- data/lib/alula/procedures/user_transfer_cancel.rb +18 -0
- data/lib/alula/procedures/user_transfer_deny.rb +19 -0
- data/lib/alula/procedures/user_transfer_reject.rb +19 -0
- data/lib/alula/procedures/user_transfer_request.rb +19 -0
- data/lib/alula/query_interface.rb +142 -0
- data/lib/alula/rate_limit.rb +11 -0
- data/lib/alula/relationship_attributes.rb +107 -0
- data/lib/alula/resource_attributes.rb +206 -0
- data/lib/alula/resources/admin_user.rb +207 -0
- data/lib/alula/resources/billing_program.rb +41 -0
- data/lib/alula/resources/dealer.rb +218 -0
- data/lib/alula/resources/dealer_account_transfer.rb +172 -0
- data/lib/alula/resources/dealer_address.rb +89 -0
- data/lib/alula/resources/dealer_branding.rb +226 -0
- data/lib/alula/resources/dealer_program.rb +75 -0
- data/lib/alula/resources/dealer_suspension_log.rb +49 -0
- data/lib/alula/resources/device.rb +716 -0
- data/lib/alula/resources/device_cellular_status.rb +134 -0
- data/lib/alula/resources/device_charge.rb +70 -0
- data/lib/alula/resources/device_event_log.rb +167 -0
- data/lib/alula/resources/device_program.rb +54 -0
- data/lib/alula/resources/event_trigger.rb +75 -0
- data/lib/alula/resources/event_webhook.rb +47 -0
- data/lib/alula/resources/feature_bysubject.rb +74 -0
- data/lib/alula/resources/feature_plan.rb +57 -0
- data/lib/alula/resources/feature_planvideo.rb +54 -0
- data/lib/alula/resources/feature_price.rb +46 -0
- data/lib/alula/resources/receiver_connection.rb +95 -0
- data/lib/alula/resources/receiver_group.rb +74 -0
- data/lib/alula/resources/revision.rb +91 -0
- data/lib/alula/resources/self.rb +61 -0
- data/lib/alula/resources/station.rb +130 -0
- data/lib/alula/resources/token_exchange.rb +34 -0
- data/lib/alula/resources/user.rb +229 -0
- data/lib/alula/resources/user_address.rb +121 -0
- data/lib/alula/resources/user_phone.rb +116 -0
- data/lib/alula/resources/user_preferences.rb +57 -0
- data/lib/alula/resources/user_pushtoken.rb +75 -0
- data/lib/alula/resources/user_videoprofile.rb +38 -0
- data/lib/alula/rest_resource.rb +17 -0
- data/lib/alula/rpc_resource.rb +40 -0
- data/lib/alula/rpc_response.rb +14 -0
- data/lib/alula/singleton_rest_resource.rb +26 -0
- data/lib/alula/util.rb +107 -0
- data/lib/alula/version.rb +5 -0
- data/lib/alula.rb +135 -0
- data/lib/parser.rb +199 -0
- metadata +282 -0
data/lib/alula/oauth.rb
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
module Alula
|
4
|
+
class Oauth
|
5
|
+
include HTTParty
|
6
|
+
|
7
|
+
class << self
|
8
|
+
# Has pseudo attr readers :client_id, :client_secret, :api_url, :debug
|
9
|
+
|
10
|
+
def configure(**config)
|
11
|
+
self.api_url = config[:api_url]
|
12
|
+
self.client_id = config[:client_id]
|
13
|
+
self.client_secret = config[:client_secret]
|
14
|
+
self.debug = config[:debug] == true
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def authenticate(username: nil, password: nil, grant_type: :password, scopes: nil)
|
19
|
+
raise Alula::NotConfiguredError.new('did you forget to call Alula::Oauth.configure ?') unless api_url
|
20
|
+
|
21
|
+
raise Alula::NotConfiguredError.new('no scopes specified') if grant_type.to_sym == :client_credentials && (scopes.nil? || scopes == '')
|
22
|
+
|
23
|
+
opts = {
|
24
|
+
body: {
|
25
|
+
grant_type: grant_type.to_s,
|
26
|
+
client_id: client_id,
|
27
|
+
client_secret: client_secret,
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
if grant_type == :password
|
32
|
+
opts[:body][:username] = username if username
|
33
|
+
opts[:body][:password] = password if password
|
34
|
+
end
|
35
|
+
|
36
|
+
opts[:body][:scope] = scopes if grant_type.to_sym == :client_credentials
|
37
|
+
|
38
|
+
if self.debug
|
39
|
+
opts[:debug_output] = Alula.logger
|
40
|
+
# sets the HTTParty logger
|
41
|
+
logger Alula.logger, :info
|
42
|
+
end
|
43
|
+
|
44
|
+
response = post(api_url + '/oauth/token', opts)
|
45
|
+
|
46
|
+
if response.ok?
|
47
|
+
Response.new(response.parsed_response)
|
48
|
+
else
|
49
|
+
Error.new(response.parsed_response)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def refresh(refresh_token:, access_token:)
|
54
|
+
opts = {
|
55
|
+
body: {
|
56
|
+
grant_type: 'refresh_token',
|
57
|
+
client_id: client_id,
|
58
|
+
client_secret: client_secret,
|
59
|
+
refresh_token: refresh_token,
|
60
|
+
},
|
61
|
+
headers: {
|
62
|
+
'Authorization:': "Bearer #{access_token}"
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
if self.debug == true
|
67
|
+
opts[:debug_output] = Alula.logger
|
68
|
+
end
|
69
|
+
|
70
|
+
response = post(api_url + '/oauth/token', opts)
|
71
|
+
|
72
|
+
if response.ok?
|
73
|
+
Response.new(response.parsed_response)
|
74
|
+
else
|
75
|
+
Error.new(response.parsed_response)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
%i(api_url client_id client_secret debug).each do |prop|
|
80
|
+
define_method(prop) do
|
81
|
+
RequestStore.store["alula_#{prop}"]
|
82
|
+
end
|
83
|
+
|
84
|
+
define_method("#{prop}=") do |value|
|
85
|
+
RequestStore.store["alula_#{prop}"] = value
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Simple Oauth::Response reader object
|
91
|
+
class Response
|
92
|
+
attr_reader :token_type, :access_token, :expires_in, :expires_at, :refresh_token, :scope
|
93
|
+
|
94
|
+
def initialize(attributes)
|
95
|
+
@raw_response = attributes
|
96
|
+
|
97
|
+
@token_type = attributes['token_type']
|
98
|
+
@access_token = attributes['access_token']
|
99
|
+
@expires_in = attributes['expires_in']
|
100
|
+
@expires_at = Time.now + @expires_in
|
101
|
+
@refresh_token = attributes['refresh_token']
|
102
|
+
@scope = attributes['scope']
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Simple representation of an auth error
|
107
|
+
class Error
|
108
|
+
attr_reader :code, :error, :error_description, :raw_response
|
109
|
+
|
110
|
+
def initialize(attributes)
|
111
|
+
@raw_response = attributes
|
112
|
+
@code = attributes['code']
|
113
|
+
@error = attributes['error']
|
114
|
+
@error_description = attributes['error_description'] || attributes['message']
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Alula
|
2
|
+
class Pagination
|
3
|
+
attr_reader :total, :number, :size
|
4
|
+
|
5
|
+
def initialize(meta_page_obj)
|
6
|
+
@total = meta_page_obj['total']
|
7
|
+
@number = meta_page_obj['number']
|
8
|
+
@size = meta_page_obj['size']
|
9
|
+
end
|
10
|
+
|
11
|
+
def has_next?
|
12
|
+
number < page_count
|
13
|
+
end
|
14
|
+
|
15
|
+
def has_prev?
|
16
|
+
number > 1
|
17
|
+
end
|
18
|
+
|
19
|
+
def page_count
|
20
|
+
(total.to_f / size.to_f).ceil
|
21
|
+
rescue ZeroDivisionError
|
22
|
+
0
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Alula
|
2
|
+
class DealerDeviceStatsProc < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(dealer_id:)
|
8
|
+
request(
|
9
|
+
http_method: :post,
|
10
|
+
path: '/rpc/v1/dealers/devices/stats/get',
|
11
|
+
payload: { dealerId: dealer_id },
|
12
|
+
handler: Response
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
##
|
2
|
+
# dealerId string GUID of the dealer to operate on
|
3
|
+
#
|
4
|
+
|
5
|
+
# Method: dealers.restore
|
6
|
+
module Alula
|
7
|
+
class DealerRestoreProc < Alula::RpcResource
|
8
|
+
|
9
|
+
class Response < Alula::RpcResponse
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.call(dealer_id:)
|
13
|
+
payload = {
|
14
|
+
dealerId: dealer_id,
|
15
|
+
}
|
16
|
+
|
17
|
+
request(
|
18
|
+
http_method: :post,
|
19
|
+
path: '/rpc/v1/dealers/restore',
|
20
|
+
payload: payload,
|
21
|
+
handler: Response
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
##
|
2
|
+
# dealerId string GUID of the dealer to operate on
|
3
|
+
#
|
4
|
+
|
5
|
+
# Method: dealers.suspend
|
6
|
+
module Alula
|
7
|
+
class DealerSuspendProc < Alula::RpcResource
|
8
|
+
|
9
|
+
class Response < Alula::RpcResponse
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.call(dealer_id:)
|
13
|
+
payload = {
|
14
|
+
dealerId: dealer_id,
|
15
|
+
}
|
16
|
+
|
17
|
+
request(
|
18
|
+
http_method: :post,
|
19
|
+
path: '/rpc/v1/dealers/suspend',
|
20
|
+
payload: payload,
|
21
|
+
handler: Response
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Alula
|
2
|
+
class DeviceAssignProc < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(customer_id:, device_id:, pin: nil)
|
8
|
+
payload = {
|
9
|
+
customerId: customer_id,
|
10
|
+
deviceId: device_id,
|
11
|
+
}
|
12
|
+
|
13
|
+
payload[:pin] = pin unless pin.nil?
|
14
|
+
|
15
|
+
request(
|
16
|
+
http_method: :post,
|
17
|
+
path: '/rpc/v1/devices/assign',
|
18
|
+
payload: payload,
|
19
|
+
handler: Response
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# deviceId string Device ID (36-char UUID)
|
3
|
+
# startAt string The earliest date to include in the results. format: date-time
|
4
|
+
# stopAt string The latest date to include in the results. format: date-time
|
5
|
+
#
|
6
|
+
|
7
|
+
# Method: devices.register
|
8
|
+
module Alula
|
9
|
+
class DeviceCellularHistoryProc < Alula::RpcResource
|
10
|
+
ONE_DAY = 86_400
|
11
|
+
class Response < Alula::RpcResponse
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.call(device_id:, start_at: nil, stop_at: nil)
|
15
|
+
# Helpers to set start/stop if only one is passed
|
16
|
+
seven_days_in_seconds = Alula::DeviceCellularHistoryProc::ONE_DAY * 7
|
17
|
+
|
18
|
+
stop_at = start_at + seven_days_in_seconds if stop_at.nil?
|
19
|
+
start_at = stop_at - seven_days_in_seconds if start_at.nil?
|
20
|
+
|
21
|
+
request(
|
22
|
+
http_method: :post,
|
23
|
+
path: '/rpc/v1/devices/cellular/history/get',
|
24
|
+
payload: {
|
25
|
+
deviceId: device_id,
|
26
|
+
startAt: start_at.utc.iso8601,
|
27
|
+
stopAt: stop_at.utc.iso8601
|
28
|
+
},
|
29
|
+
handler: Response
|
30
|
+
)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Method: devices.rateplan.get
|
2
|
+
module Alula
|
3
|
+
class DeviceRatePlanGetProc < Alula::RpcResource
|
4
|
+
|
5
|
+
class Response < Alula::RpcResponse
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.call(device_id:)
|
9
|
+
payload = {
|
10
|
+
deviceId: device_id
|
11
|
+
}
|
12
|
+
|
13
|
+
request(
|
14
|
+
http_method: :post,
|
15
|
+
path: '/rpc/v1/devices/rateplan/get',
|
16
|
+
payload: payload,
|
17
|
+
handler: Response
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
##
|
2
|
+
# crc string 4 digit number; hexadecimal for Helix devices, decimal otherwise
|
3
|
+
# dealerId string Dealer ID (36-character UUID)
|
4
|
+
# mac string MAC address (hex, transmission order, colon/slash separated)
|
5
|
+
# skipPartnerClaim boolean Set to true to skip Helix partner configuration [true, false]
|
6
|
+
#
|
7
|
+
|
8
|
+
# Method: devices.register
|
9
|
+
module Alula
|
10
|
+
class DeviceRegisterProc < Alula::RpcResource
|
11
|
+
|
12
|
+
class Response < Alula::RpcResponse
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.call(mac:, dealer_id:, crc:, skip_partner_claim: false)
|
16
|
+
payload = {
|
17
|
+
mac: mac,
|
18
|
+
crc: crc,
|
19
|
+
dealerId: dealer_id,
|
20
|
+
skipPartnerClaim: skip_partner_claim
|
21
|
+
}
|
22
|
+
|
23
|
+
request(
|
24
|
+
http_method: :post,
|
25
|
+
path: '/rpc/v1/devices/register',
|
26
|
+
payload: payload,
|
27
|
+
handler: Response
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Alula
|
2
|
+
class DeviceSignalAddProc < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
def initialize(response)
|
6
|
+
super(response)
|
7
|
+
#
|
8
|
+
# This RPC response gives a new EventLog item
|
9
|
+
data = response.data['result']['data'][0]
|
10
|
+
@data = Alula::DeviceEventLog.new(data['id'], data['attributes'])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.call(action:, customer_id:, dealer_id:, device_id:, group_id:, log_format:,
|
15
|
+
mac:, relay_status:, signal_account_number:, signal_event_code:, signal_event_qualifier:,
|
16
|
+
signal_partition:, signal_user_zone:, sn:)
|
17
|
+
payload = {
|
18
|
+
action: action,
|
19
|
+
customerId: customer_id,
|
20
|
+
dealerId: dealer_id,
|
21
|
+
deviceId: device_id,
|
22
|
+
groupId: group_id,
|
23
|
+
logFormat: log_format,
|
24
|
+
mac: mac,
|
25
|
+
relayStatus: relay_status,
|
26
|
+
signalAccountNumber: signal_account_number,
|
27
|
+
signalEventCode: signal_event_code,
|
28
|
+
signalEventQualifier: signal_event_qualifier,
|
29
|
+
signalPartition: signal_partition,
|
30
|
+
signalUserZone: signal_user_zone,
|
31
|
+
sn: sn,
|
32
|
+
}
|
33
|
+
|
34
|
+
request(
|
35
|
+
http_method: :post,
|
36
|
+
path: '/rpc/v1/devices/signal/add',
|
37
|
+
payload: payload,
|
38
|
+
handler: Response
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Alula
|
2
|
+
class DeviceSignalDeliveredProc < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
def initialize(response)
|
6
|
+
super(response)
|
7
|
+
#
|
8
|
+
# This RPC response gives an updated EventLog item
|
9
|
+
data = response.data['result']['data'][0]
|
10
|
+
@data = Alula::DeviceEventLog.new(data['id'], data['attributes'])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.call(dealer_id:, device_id:, group_id:, log_format:, mac:)
|
15
|
+
payload = {
|
16
|
+
dealerId: dealer_id,
|
17
|
+
deviceId: device_id,
|
18
|
+
groupId: group_id,
|
19
|
+
logFormat: log_format,
|
20
|
+
mac: mac,
|
21
|
+
}
|
22
|
+
|
23
|
+
request(
|
24
|
+
http_method: :post,
|
25
|
+
path: '/rpc/v1/devices/signal/delivered',
|
26
|
+
payload: payload,
|
27
|
+
handler: Response
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Alula
|
2
|
+
class DeviceSignalUpdateProc < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
def initialize(response)
|
6
|
+
super(response)
|
7
|
+
#
|
8
|
+
# This RPC response gives an updated EventLog item
|
9
|
+
data = response.data['result']['data'][0]
|
10
|
+
@data = Alula::DeviceEventLog.new(data['id'], data['attributes'])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.call(dealer_id:, device_id:, group_id:, log_format:, mac:, relay_status:)
|
15
|
+
payload = {
|
16
|
+
dealerId: dealer_id,
|
17
|
+
deviceId: device_id,
|
18
|
+
groupId: group_id,
|
19
|
+
logFormat: log_format,
|
20
|
+
mac: mac,
|
21
|
+
relayStatus: relay_status,
|
22
|
+
}
|
23
|
+
|
24
|
+
request(
|
25
|
+
http_method: :post,
|
26
|
+
path: '/rpc/v1/devices/signal/update',
|
27
|
+
payload: payload,
|
28
|
+
handler: Response
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Alula
|
2
|
+
class DeviceUnassignProc < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(device_id:)
|
8
|
+
request(
|
9
|
+
http_method: :post,
|
10
|
+
path: '/rpc/v1/devices/unassign',
|
11
|
+
payload: { deviceId: device_id },
|
12
|
+
handler: Response
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Alula
|
2
|
+
class DeviceUnregisterProc < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(mac:, deactivate:)
|
8
|
+
payload = {
|
9
|
+
mac: mac,
|
10
|
+
deactivate: deactivate,
|
11
|
+
}
|
12
|
+
|
13
|
+
request(
|
14
|
+
http_method: :post,
|
15
|
+
path: '/rpc/v1/devices/unregister',
|
16
|
+
payload: payload,
|
17
|
+
handler: Response
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Alula
|
2
|
+
class UploadTouchpadBrandingProc < Alula::RpcResource
|
3
|
+
class Response < Alula::RpcResponse
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.call(dealer_id:, branding_file:)
|
7
|
+
payload = {
|
8
|
+
dealerId: dealer_id,
|
9
|
+
brandingFile: branding_file
|
10
|
+
}
|
11
|
+
|
12
|
+
request(
|
13
|
+
http_method: :post,
|
14
|
+
path: '/upload/v1/dealers/branding/touchpad',
|
15
|
+
payload: payload,
|
16
|
+
handler: Response,
|
17
|
+
wrap: false,
|
18
|
+
opts: {
|
19
|
+
multipart: true
|
20
|
+
}
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Method: devices.rateplan.get
|
2
|
+
module Alula
|
3
|
+
class UserPlansVideoPriceGetProc < Alula::RpcResource
|
4
|
+
|
5
|
+
class Response < Alula::RpcResponse
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.call(user_id:)
|
9
|
+
payload = {
|
10
|
+
userId: user_id
|
11
|
+
}
|
12
|
+
|
13
|
+
request(
|
14
|
+
http_method: :post,
|
15
|
+
path: '/rpc/v1/users/plansvideo/price/get',
|
16
|
+
payload: payload,
|
17
|
+
handler: Response
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Alula
|
2
|
+
class UserTransferAccept < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(transfer_id:, description:)
|
8
|
+
request(
|
9
|
+
http_method: :post,
|
10
|
+
path: '/rpc/v1/users/transfer/accept',
|
11
|
+
payload: {
|
12
|
+
id: transfer_id,
|
13
|
+
description: description,
|
14
|
+
},
|
15
|
+
handler: Response
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Alula
|
2
|
+
class UserTransferAuthorize < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(transfer_id:)
|
8
|
+
request(
|
9
|
+
http_method: :post,
|
10
|
+
path: '/rpc/v1/users/transfer/authorize',
|
11
|
+
payload: {
|
12
|
+
id: transfer_id
|
13
|
+
},
|
14
|
+
handler: Response
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Alula
|
2
|
+
class UserTransferCancel < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(transfer_id:)
|
8
|
+
request(
|
9
|
+
http_method: :post,
|
10
|
+
path: '/rpc/v1/users/transfer/cancel',
|
11
|
+
payload: {
|
12
|
+
id: transfer_id
|
13
|
+
},
|
14
|
+
handler: Response
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Alula
|
2
|
+
class UserTransferDeny < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(transfer_id:, description:)
|
8
|
+
request(
|
9
|
+
http_method: :post,
|
10
|
+
path: '/rpc/v1/users/transfer/deny',
|
11
|
+
payload: {
|
12
|
+
id: transfer_id,
|
13
|
+
reason: description,
|
14
|
+
},
|
15
|
+
handler: Response
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Alula
|
2
|
+
class UserTransferReject < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(transfer_id:, description:)
|
8
|
+
request(
|
9
|
+
http_method: :post,
|
10
|
+
path: '/rpc/v1/users/transfer/reject',
|
11
|
+
payload: {
|
12
|
+
id: transfer_id,
|
13
|
+
reason: description,
|
14
|
+
},
|
15
|
+
handler: Response
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Alula
|
2
|
+
class UserTransferRequest < Alula::RpcResource
|
3
|
+
|
4
|
+
class Response < Alula::RpcResponse
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.call(customer_id:, dealer_id:)
|
8
|
+
request(
|
9
|
+
http_method: :post,
|
10
|
+
path: '/rpc/v1/users/transfer/request',
|
11
|
+
payload: {
|
12
|
+
customerId: customer_id,
|
13
|
+
dealerId: dealer_id
|
14
|
+
},
|
15
|
+
handler: Response
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|