celitech 2.0.7
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 +7 -0
- data/README.md +225 -0
- data/lib/celitech/client.rb +81 -0
- data/lib/celitech/config.rb +48 -0
- data/lib/celitech/environment.rb +7 -0
- data/lib/celitech/error.rb +50 -0
- data/lib/celitech/http/connection.rb +321 -0
- data/lib/celitech/http/hooks.rb +17 -0
- data/lib/celitech/http/oauth_token_manager.rb +76 -0
- data/lib/celitech/http/response.rb +35 -0
- data/lib/celitech/models/bad_request.rb +47 -0
- data/lib/celitech/models/create_purchase_ok_response.rb +63 -0
- data/lib/celitech/models/create_purchase_ok_response_profile.rb +75 -0
- data/lib/celitech/models/create_purchase_ok_response_purchase.rb +111 -0
- data/lib/celitech/models/create_purchase_request.rb +155 -0
- data/lib/celitech/models/create_purchase_request_language.rb +14 -0
- data/lib/celitech/models/create_purchase_v2_ok_response.rb +63 -0
- data/lib/celitech/models/create_purchase_v2_ok_response_profile.rb +96 -0
- data/lib/celitech/models/create_purchase_v2_ok_response_purchase.rb +70 -0
- data/lib/celitech/models/create_purchase_v2_request.rb +156 -0
- data/lib/celitech/models/create_purchase_v2_request_language.rb +14 -0
- data/lib/celitech/models/destinations.rb +80 -0
- data/lib/celitech/models/device.rb +80 -0
- data/lib/celitech/models/edit_purchase_ok_response.rb +90 -0
- data/lib/celitech/models/edit_purchase_request.rb +90 -0
- data/lib/celitech/models/get_esim_device_ok_response.rb +52 -0
- data/lib/celitech/models/get_esim_history_ok_response.rb +52 -0
- data/lib/celitech/models/get_esim_history_ok_response_esim.rb +61 -0
- data/lib/celitech/models/get_esim_ok_response.rb +52 -0
- data/lib/celitech/models/get_esim_ok_response_esim.rb +116 -0
- data/lib/celitech/models/get_purchase_consumption_ok_response.rb +70 -0
- data/lib/celitech/models/grant_type.rb +10 -0
- data/lib/celitech/models/history.rb +70 -0
- data/lib/celitech/models/list_destinations_ok_response.rb +51 -0
- data/lib/celitech/models/list_packages_ok_response.rb +64 -0
- data/lib/celitech/models/list_purchases_ok_response.rb +64 -0
- data/lib/celitech/models/o_auth_token_request.rb +84 -0
- data/lib/celitech/models/o_auth_token_response.rb +60 -0
- data/lib/celitech/models/open_model.rb +30 -0
- data/lib/celitech/models/package.rb +111 -0
- data/lib/celitech/models/packages.rb +121 -0
- data/lib/celitech/models/purchases.rb +178 -0
- data/lib/celitech/models/purchases_esim.rb +51 -0
- data/lib/celitech/models/serializable.rb +63 -0
- data/lib/celitech/models/token_ok_response.rb +47 -0
- data/lib/celitech/models/top_up_esim_ok_response.rb +63 -0
- data/lib/celitech/models/top_up_esim_ok_response_profile.rb +51 -0
- data/lib/celitech/models/top_up_esim_ok_response_purchase.rb +111 -0
- data/lib/celitech/models/top_up_esim_request.rb +145 -0
- data/lib/celitech/models/unauthorized.rb +47 -0
- data/lib/celitech/models/union_type.rb +12 -0
- data/lib/celitech/serializers/form_serializer.rb +41 -0
- data/lib/celitech/serializers/json_serializer.rb +41 -0
- data/lib/celitech/services/destinations.rb +59 -0
- data/lib/celitech/services/e_sim.rb +108 -0
- data/lib/celitech/services/i_frame.rb +59 -0
- data/lib/celitech/services/o_auth.rb +49 -0
- data/lib/celitech/services/packages.rb +82 -0
- data/lib/celitech/services/purchases.rb +195 -0
- data/lib/celitech/validator.rb +42 -0
- data/lib/celitech/version.rb +5 -0
- data/lib/celitech.rb +64 -0
- metadata +162 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Celitech
|
|
4
|
+
module Models
|
|
5
|
+
class GetPurchaseConsumptionOkResponse
|
|
6
|
+
include ::Celitech::Models::Serializable
|
|
7
|
+
include ::Celitech::Models::OpenModel
|
|
8
|
+
|
|
9
|
+
def self.wire_keys
|
|
10
|
+
{
|
|
11
|
+
data_usage_remaining_in_bytes: 'dataUsageRemainingInBytes',
|
|
12
|
+
data_usage_remaining_in_gb: 'dataUsageRemainingInGB',
|
|
13
|
+
status: 'status',
|
|
14
|
+
}.freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def data_usage_remaining_in_bytes
|
|
18
|
+
val = @data_usage_remaining_in_bytes
|
|
19
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def data_usage_remaining_in_gb
|
|
23
|
+
val = @data_usage_remaining_in_gb
|
|
24
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def status
|
|
28
|
+
val = @status
|
|
29
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
attr_reader :additional_properties
|
|
33
|
+
|
|
34
|
+
def initialize(
|
|
35
|
+
data_usage_remaining_in_bytes: ::Celitech::Models::UNSET,
|
|
36
|
+
data_usage_remaining_in_gb: ::Celitech::Models::UNSET,
|
|
37
|
+
status: ::Celitech::Models::UNSET,
|
|
38
|
+
additional_properties: {}
|
|
39
|
+
)
|
|
40
|
+
@data_usage_remaining_in_bytes = data_usage_remaining_in_bytes
|
|
41
|
+
@data_usage_remaining_in_gb = data_usage_remaining_in_gb
|
|
42
|
+
@status = status
|
|
43
|
+
@additional_properties = additional_properties
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.from_hash(hash)
|
|
47
|
+
return unless hash
|
|
48
|
+
|
|
49
|
+
new(
|
|
50
|
+
data_usage_remaining_in_bytes: hash.fetch('dataUsageRemainingInBytes', ::Celitech::Models::UNSET),
|
|
51
|
+
data_usage_remaining_in_gb: hash.fetch('dataUsageRemainingInGB', ::Celitech::Models::UNSET),
|
|
52
|
+
status: hash.fetch('status', ::Celitech::Models::UNSET),
|
|
53
|
+
additional_properties: hash.except('dataUsageRemainingInBytes', 'dataUsageRemainingInGB', 'status'),
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def attributes
|
|
58
|
+
{
|
|
59
|
+
data_usage_remaining_in_bytes: @data_usage_remaining_in_bytes,
|
|
60
|
+
data_usage_remaining_in_gb: @data_usage_remaining_in_gb,
|
|
61
|
+
status: @status,
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def open_model_extras
|
|
66
|
+
@additional_properties
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Celitech
|
|
4
|
+
module Models
|
|
5
|
+
class History
|
|
6
|
+
include ::Celitech::Models::Serializable
|
|
7
|
+
include ::Celitech::Models::OpenModel
|
|
8
|
+
|
|
9
|
+
def self.wire_keys
|
|
10
|
+
{
|
|
11
|
+
status: 'status',
|
|
12
|
+
status_date: 'statusDate',
|
|
13
|
+
date: 'date',
|
|
14
|
+
}.freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def status
|
|
18
|
+
val = @status
|
|
19
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def status_date
|
|
23
|
+
val = @status_date
|
|
24
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def date
|
|
28
|
+
val = @date
|
|
29
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
attr_reader :additional_properties
|
|
33
|
+
|
|
34
|
+
def initialize(
|
|
35
|
+
status: ::Celitech::Models::UNSET,
|
|
36
|
+
status_date: ::Celitech::Models::UNSET,
|
|
37
|
+
date: ::Celitech::Models::UNSET,
|
|
38
|
+
additional_properties: {}
|
|
39
|
+
)
|
|
40
|
+
@status = status
|
|
41
|
+
@status_date = status_date
|
|
42
|
+
@date = date
|
|
43
|
+
@additional_properties = additional_properties
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.from_hash(hash)
|
|
47
|
+
return unless hash
|
|
48
|
+
|
|
49
|
+
new(
|
|
50
|
+
status: hash.fetch('status', ::Celitech::Models::UNSET),
|
|
51
|
+
status_date: hash.fetch('statusDate', ::Celitech::Models::UNSET),
|
|
52
|
+
date: hash.fetch('date', ::Celitech::Models::UNSET),
|
|
53
|
+
additional_properties: hash.except('status', 'statusDate', 'date'),
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def attributes
|
|
58
|
+
{
|
|
59
|
+
status: @status,
|
|
60
|
+
status_date: @status_date,
|
|
61
|
+
date: @date,
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def open_model_extras
|
|
66
|
+
@additional_properties
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Celitech
|
|
4
|
+
module Models
|
|
5
|
+
class ListDestinationsOkResponse
|
|
6
|
+
include ::Celitech::Models::Serializable
|
|
7
|
+
include ::Celitech::Models::OpenModel
|
|
8
|
+
|
|
9
|
+
def self.wire_keys
|
|
10
|
+
{
|
|
11
|
+
destinations: 'destinations',
|
|
12
|
+
}.freeze
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def destinations
|
|
16
|
+
val = @destinations
|
|
17
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
attr_reader :additional_properties
|
|
21
|
+
|
|
22
|
+
def initialize(destinations: ::Celitech::Models::UNSET, additional_properties: {})
|
|
23
|
+
@destinations = destinations
|
|
24
|
+
@additional_properties = additional_properties
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.from_hash(hash)
|
|
28
|
+
return unless hash
|
|
29
|
+
|
|
30
|
+
new(
|
|
31
|
+
destinations: hash.fetch('destinations', ::Celitech::Models::UNSET),
|
|
32
|
+
additional_properties: hash.except('destinations'),
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def attributes
|
|
37
|
+
{
|
|
38
|
+
destinations: @destinations,
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def validate!
|
|
43
|
+
@destinations&.each { |item| item.validate! if item.respond_to?(:validate!) } unless @destinations.equal?(::Celitech::Models::UNSET)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def open_model_extras
|
|
47
|
+
@additional_properties
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Celitech
|
|
4
|
+
module Models
|
|
5
|
+
class ListPackagesOkResponse
|
|
6
|
+
include ::Celitech::Models::Serializable
|
|
7
|
+
include ::Celitech::Models::OpenModel
|
|
8
|
+
|
|
9
|
+
def self.wire_keys
|
|
10
|
+
{
|
|
11
|
+
packages: 'packages',
|
|
12
|
+
after_cursor: 'afterCursor',
|
|
13
|
+
}.freeze
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def packages
|
|
17
|
+
val = @packages
|
|
18
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def after_cursor
|
|
22
|
+
val = @after_cursor
|
|
23
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
attr_reader :additional_properties
|
|
27
|
+
|
|
28
|
+
def initialize(
|
|
29
|
+
packages: ::Celitech::Models::UNSET,
|
|
30
|
+
after_cursor: ::Celitech::Models::UNSET,
|
|
31
|
+
additional_properties: {}
|
|
32
|
+
)
|
|
33
|
+
@packages = packages
|
|
34
|
+
@after_cursor = after_cursor
|
|
35
|
+
@additional_properties = additional_properties
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.from_hash(hash)
|
|
39
|
+
return unless hash
|
|
40
|
+
|
|
41
|
+
new(
|
|
42
|
+
packages: hash.fetch('packages', ::Celitech::Models::UNSET),
|
|
43
|
+
after_cursor: hash.fetch('afterCursor', ::Celitech::Models::UNSET),
|
|
44
|
+
additional_properties: hash.except('packages', 'afterCursor'),
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def attributes
|
|
49
|
+
{
|
|
50
|
+
packages: @packages,
|
|
51
|
+
after_cursor: @after_cursor,
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def validate!
|
|
56
|
+
@packages&.each { |item| item.validate! if item.respond_to?(:validate!) } unless @packages.equal?(::Celitech::Models::UNSET)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def open_model_extras
|
|
60
|
+
@additional_properties
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Celitech
|
|
4
|
+
module Models
|
|
5
|
+
class ListPurchasesOkResponse
|
|
6
|
+
include ::Celitech::Models::Serializable
|
|
7
|
+
include ::Celitech::Models::OpenModel
|
|
8
|
+
|
|
9
|
+
def self.wire_keys
|
|
10
|
+
{
|
|
11
|
+
purchases: 'purchases',
|
|
12
|
+
after_cursor: 'afterCursor',
|
|
13
|
+
}.freeze
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def purchases
|
|
17
|
+
val = @purchases
|
|
18
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def after_cursor
|
|
22
|
+
val = @after_cursor
|
|
23
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
attr_reader :additional_properties
|
|
27
|
+
|
|
28
|
+
def initialize(
|
|
29
|
+
purchases: ::Celitech::Models::UNSET,
|
|
30
|
+
after_cursor: ::Celitech::Models::UNSET,
|
|
31
|
+
additional_properties: {}
|
|
32
|
+
)
|
|
33
|
+
@purchases = purchases
|
|
34
|
+
@after_cursor = after_cursor
|
|
35
|
+
@additional_properties = additional_properties
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.from_hash(hash)
|
|
39
|
+
return unless hash
|
|
40
|
+
|
|
41
|
+
new(
|
|
42
|
+
purchases: hash.fetch('purchases', ::Celitech::Models::UNSET),
|
|
43
|
+
after_cursor: hash.fetch('afterCursor', ::Celitech::Models::UNSET),
|
|
44
|
+
additional_properties: hash.except('purchases', 'afterCursor'),
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def attributes
|
|
49
|
+
{
|
|
50
|
+
purchases: @purchases,
|
|
51
|
+
after_cursor: @after_cursor,
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def validate!
|
|
56
|
+
@purchases&.each { |item| item.validate! if item.respond_to?(:validate!) } unless @purchases.equal?(::Celitech::Models::UNSET)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def open_model_extras
|
|
60
|
+
@additional_properties
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Celitech
|
|
4
|
+
module Models
|
|
5
|
+
class OAuthTokenRequest
|
|
6
|
+
include ::Celitech::Models::Serializable
|
|
7
|
+
include ::Celitech::Models::OpenModel
|
|
8
|
+
|
|
9
|
+
def self.wire_keys
|
|
10
|
+
{
|
|
11
|
+
grant_type: 'grant_type',
|
|
12
|
+
client_id: 'client_id',
|
|
13
|
+
client_secret: 'client_secret',
|
|
14
|
+
scope: 'scope',
|
|
15
|
+
}.freeze
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def grant_type
|
|
19
|
+
val = @grant_type
|
|
20
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def client_id
|
|
24
|
+
val = @client_id
|
|
25
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def client_secret
|
|
29
|
+
val = @client_secret
|
|
30
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def scope
|
|
34
|
+
val = @scope
|
|
35
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
attr_reader :additional_properties
|
|
39
|
+
|
|
40
|
+
def initialize(
|
|
41
|
+
grant_type: ::Celitech::Models::UNSET,
|
|
42
|
+
client_id: ::Celitech::Models::UNSET,
|
|
43
|
+
client_secret: ::Celitech::Models::UNSET,
|
|
44
|
+
scope: ::Celitech::Models::UNSET,
|
|
45
|
+
additional_properties: {}
|
|
46
|
+
)
|
|
47
|
+
@grant_type = grant_type
|
|
48
|
+
@client_id = client_id
|
|
49
|
+
@client_secret = client_secret
|
|
50
|
+
@scope = scope
|
|
51
|
+
@additional_properties = additional_properties
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.from_hash(hash)
|
|
55
|
+
return unless hash
|
|
56
|
+
|
|
57
|
+
new(
|
|
58
|
+
grant_type: hash.fetch('grant_type', ::Celitech::Models::UNSET),
|
|
59
|
+
client_id: hash.fetch('client_id', ::Celitech::Models::UNSET),
|
|
60
|
+
client_secret: hash.fetch('client_secret', ::Celitech::Models::UNSET),
|
|
61
|
+
scope: hash.fetch('scope', ::Celitech::Models::UNSET),
|
|
62
|
+
additional_properties: hash.except('grant_type', 'client_id', 'client_secret', 'scope'),
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def attributes
|
|
67
|
+
{
|
|
68
|
+
grant_type: @grant_type,
|
|
69
|
+
client_id: @client_id,
|
|
70
|
+
client_secret: @client_secret,
|
|
71
|
+
scope: @scope,
|
|
72
|
+
}
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def validate!
|
|
76
|
+
@grant_type&.validate! if !@grant_type.equal?(::Celitech::Models::UNSET) && @grant_type.respond_to?(:validate!)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def open_model_extras
|
|
80
|
+
@additional_properties
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Celitech
|
|
4
|
+
module Models
|
|
5
|
+
class OAuthTokenResponse
|
|
6
|
+
include ::Celitech::Models::Serializable
|
|
7
|
+
include ::Celitech::Models::OpenModel
|
|
8
|
+
|
|
9
|
+
def self.wire_keys
|
|
10
|
+
{
|
|
11
|
+
access_token: 'access_token',
|
|
12
|
+
expires_in: 'expires_in',
|
|
13
|
+
}.freeze
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def access_token
|
|
17
|
+
val = @access_token
|
|
18
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def expires_in
|
|
22
|
+
val = @expires_in
|
|
23
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
attr_reader :additional_properties
|
|
27
|
+
|
|
28
|
+
def initialize(
|
|
29
|
+
access_token: ::Celitech::Models::UNSET,
|
|
30
|
+
expires_in: ::Celitech::Models::UNSET,
|
|
31
|
+
additional_properties: {}
|
|
32
|
+
)
|
|
33
|
+
@access_token = access_token
|
|
34
|
+
@expires_in = expires_in
|
|
35
|
+
@additional_properties = additional_properties
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.from_hash(hash)
|
|
39
|
+
return unless hash
|
|
40
|
+
|
|
41
|
+
new(
|
|
42
|
+
access_token: hash.fetch('access_token', ::Celitech::Models::UNSET),
|
|
43
|
+
expires_in: hash.fetch('expires_in', ::Celitech::Models::UNSET),
|
|
44
|
+
additional_properties: hash.except('access_token', 'expires_in'),
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def attributes
|
|
49
|
+
{
|
|
50
|
+
access_token: @access_token,
|
|
51
|
+
expires_in: @expires_in,
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def open_model_extras
|
|
56
|
+
@additional_properties
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Celitech
|
|
4
|
+
module Models
|
|
5
|
+
# Marker module for open object models (additionalProperties: true).
|
|
6
|
+
#
|
|
7
|
+
# Including classes must implement:
|
|
8
|
+
# - #open_model_extras → Hash of extra key/value pairs captured from deserialization
|
|
9
|
+
#
|
|
10
|
+
# In return, this module overrides +#to_h+ to merge the extras into the
|
|
11
|
+
# symbol-keyed hash produced by +Serializable#to_h+, so round-trips through
|
|
12
|
+
# JSON preserve unknown fields without requiring schema changes.
|
|
13
|
+
#
|
|
14
|
+
# +#to_h+ is a symbol-keyed Ruby view: declared fields keep their attribute names and win
|
|
15
|
+
# on collision. +Serializers::Json.serialize+ is the wire-faithful path (keeps raw wire
|
|
16
|
+
# keys) and is what guarantees the unknown-field round-trip.
|
|
17
|
+
module OpenModel
|
|
18
|
+
def open_model_extras
|
|
19
|
+
raise NotImplementedError, "#{self.class} must implement #open_model_extras"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def to_h
|
|
23
|
+
extras = open_model_extras
|
|
24
|
+
return super if extras.nil? || extras.empty?
|
|
25
|
+
|
|
26
|
+
extras.transform_keys(&:to_sym).merge(super)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Celitech
|
|
4
|
+
module Models
|
|
5
|
+
class Package
|
|
6
|
+
include ::Celitech::Models::Serializable
|
|
7
|
+
include ::Celitech::Models::OpenModel
|
|
8
|
+
|
|
9
|
+
def self.wire_keys
|
|
10
|
+
{
|
|
11
|
+
id: 'id',
|
|
12
|
+
data_limit_in_bytes: 'dataLimitInBytes',
|
|
13
|
+
data_limit_in_gb: 'dataLimitInGB',
|
|
14
|
+
destination: 'destination',
|
|
15
|
+
destination_iso2: 'destinationISO2',
|
|
16
|
+
destination_name: 'destinationName',
|
|
17
|
+
price_in_cents: 'priceInCents',
|
|
18
|
+
}.freeze
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def id
|
|
22
|
+
val = @id
|
|
23
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def data_limit_in_bytes
|
|
27
|
+
val = @data_limit_in_bytes
|
|
28
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def data_limit_in_gb
|
|
32
|
+
val = @data_limit_in_gb
|
|
33
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def destination
|
|
37
|
+
val = @destination
|
|
38
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def destination_iso2
|
|
42
|
+
val = @destination_iso2
|
|
43
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def destination_name
|
|
47
|
+
val = @destination_name
|
|
48
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def price_in_cents
|
|
52
|
+
val = @price_in_cents
|
|
53
|
+
val.equal?(::Celitech::Models::UNSET) ? nil : val
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
attr_reader :additional_properties
|
|
57
|
+
|
|
58
|
+
def initialize(
|
|
59
|
+
id: ::Celitech::Models::UNSET,
|
|
60
|
+
data_limit_in_bytes: ::Celitech::Models::UNSET,
|
|
61
|
+
data_limit_in_gb: ::Celitech::Models::UNSET,
|
|
62
|
+
destination: ::Celitech::Models::UNSET,
|
|
63
|
+
destination_iso2: ::Celitech::Models::UNSET,
|
|
64
|
+
destination_name: ::Celitech::Models::UNSET,
|
|
65
|
+
price_in_cents: ::Celitech::Models::UNSET,
|
|
66
|
+
additional_properties: {}
|
|
67
|
+
)
|
|
68
|
+
@id = id
|
|
69
|
+
@data_limit_in_bytes = data_limit_in_bytes
|
|
70
|
+
@data_limit_in_gb = data_limit_in_gb
|
|
71
|
+
@destination = destination
|
|
72
|
+
@destination_iso2 = destination_iso2
|
|
73
|
+
@destination_name = destination_name
|
|
74
|
+
@price_in_cents = price_in_cents
|
|
75
|
+
@additional_properties = additional_properties
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.from_hash(hash)
|
|
79
|
+
return unless hash
|
|
80
|
+
|
|
81
|
+
new(
|
|
82
|
+
id: hash.fetch('id', ::Celitech::Models::UNSET),
|
|
83
|
+
data_limit_in_bytes: hash.fetch('dataLimitInBytes', ::Celitech::Models::UNSET),
|
|
84
|
+
data_limit_in_gb: hash.fetch('dataLimitInGB', ::Celitech::Models::UNSET),
|
|
85
|
+
destination: hash.fetch('destination', ::Celitech::Models::UNSET),
|
|
86
|
+
destination_iso2: hash.fetch('destinationISO2', ::Celitech::Models::UNSET),
|
|
87
|
+
destination_name: hash.fetch('destinationName', ::Celitech::Models::UNSET),
|
|
88
|
+
price_in_cents: hash.fetch('priceInCents', ::Celitech::Models::UNSET),
|
|
89
|
+
additional_properties:
|
|
90
|
+
hash.except('id', 'dataLimitInBytes', 'dataLimitInGB', 'destination', 'destinationISO2', 'destinationName', 'priceInCents'),
|
|
91
|
+
)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def attributes
|
|
95
|
+
{
|
|
96
|
+
id: @id,
|
|
97
|
+
data_limit_in_bytes: @data_limit_in_bytes,
|
|
98
|
+
data_limit_in_gb: @data_limit_in_gb,
|
|
99
|
+
destination: @destination,
|
|
100
|
+
destination_iso2: @destination_iso2,
|
|
101
|
+
destination_name: @destination_name,
|
|
102
|
+
price_in_cents: @price_in_cents,
|
|
103
|
+
}
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def open_model_extras
|
|
107
|
+
@additional_properties
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|