digital-payments-sdk 1.0.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.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +85 -0
  4. data/lib/shell_ev/api_helper.rb +10 -0
  5. data/lib/shell_ev/client.rb +86 -0
  6. data/lib/shell_ev/configuration.rb +104 -0
  7. data/lib/shell_ev/controllers/base_controller.rb +66 -0
  8. data/lib/shell_ev/controllers/digital_payment_enablement_controller.rb +56 -0
  9. data/lib/shell_ev/controllers/fueling_controller.rb +126 -0
  10. data/lib/shell_ev/controllers/partner_notification_controller.rb +95 -0
  11. data/lib/shell_ev/controllers/shell_api_platform_security_authentication_controller.rb +44 -0
  12. data/lib/shell_ev/controllers/station_locator_controller.rb +76 -0
  13. data/lib/shell_ev/exceptions/access_token_error_exception.rb +37 -0
  14. data/lib/shell_ev/exceptions/api_exception.rb +10 -0
  15. data/lib/shell_ev/exceptions/cancel_fueling_error_response_error_exception.rb +64 -0
  16. data/lib/shell_ev/exceptions/mpp_acces_token_error_response_exception.rb +44 -0
  17. data/lib/shell_ev/exceptions/payment_enablement_error_response_exception.rb +37 -0
  18. data/lib/shell_ev/exceptions/station_locator_bad_request_exception.rb +38 -0
  19. data/lib/shell_ev/exceptions/station_locator_forbidden_exception.rb +38 -0
  20. data/lib/shell_ev/exceptions/station_locator_internal_server_error_exception.rb +38 -0
  21. data/lib/shell_ev/exceptions/station_locator_not_found_exception.rb +38 -0
  22. data/lib/shell_ev/exceptions/station_locator_unauthorized_exception.rb +38 -0
  23. data/lib/shell_ev/http/auth/mpp_token.rb +42 -0
  24. data/lib/shell_ev/http/auth/o_auth_token_post.rb +44 -0
  25. data/lib/shell_ev/http/http_call_back.rb +10 -0
  26. data/lib/shell_ev/http/http_method_enum.rb +10 -0
  27. data/lib/shell_ev/http/http_request.rb +10 -0
  28. data/lib/shell_ev/http/http_response.rb +10 -0
  29. data/lib/shell_ev/models/access_token_response.rb +71 -0
  30. data/lib/shell_ev/models/around_location_array.rb +109 -0
  31. data/lib/shell_ev/models/around_location_array_data_items.rb +242 -0
  32. data/lib/shell_ev/models/around_location_array_data_items_loc.rb +99 -0
  33. data/lib/shell_ev/models/around_location_array_data_items_opening_hours_items.rb +148 -0
  34. data/lib/shell_ev/models/base_model.rb +62 -0
  35. data/lib/shell_ev/models/cancel_fueling_error_response.rb +92 -0
  36. data/lib/shell_ev/models/cancel_fueling_request.rb +61 -0
  37. data/lib/shell_ev/models/collecting_company.rb +50 -0
  38. data/lib/shell_ev/models/fault_response.rb +50 -0
  39. data/lib/shell_ev/models/fault_response_fault.rb +60 -0
  40. data/lib/shell_ev/models/fault_response_fault_detail.rb +50 -0
  41. data/lib/shell_ev/models/finalise_fueling_request.rb +181 -0
  42. data/lib/shell_ev/models/finalise_fueling_request_payment.rb +71 -0
  43. data/lib/shell_ev/models/finalise_fueling_request_products_items.rb +70 -0
  44. data/lib/shell_ev/models/loyalty_details.rb +59 -0
  45. data/lib/shell_ev/models/mobile_payment_registration_request.rb +134 -0
  46. data/lib/shell_ev/models/mpp_acces_token_response.rb +81 -0
  47. data/lib/shell_ev/models/mpp_error.rb +94 -0
  48. data/lib/shell_ev/models/mpp_token_request_body.rb +73 -0
  49. data/lib/shell_ev/models/oauth_token_post_request_body.rb +73 -0
  50. data/lib/shell_ev/models/partner_token_request_body.rb +73 -0
  51. data/lib/shell_ev/models/payment_details_items.rb +78 -0
  52. data/lib/shell_ev/models/payment_enablement_response.rb +48 -0
  53. data/lib/shell_ev/models/payment_properties.rb +169 -0
  54. data/lib/shell_ev/models/prepare_fueling_request.rb +183 -0
  55. data/lib/shell_ev/models/prepare_fueling_request_device_details_items.rb +95 -0
  56. data/lib/shell_ev/models/prepare_fueling_response.rb +66 -0
  57. data/lib/shell_ev/utilities/date_time_helper.rb +11 -0
  58. data/lib/shell_ev/utilities/file_wrapper.rb +16 -0
  59. data/lib/shell_ev.rb +85 -0
  60. data/test/controllers/controller_test_base.rb +29 -0
  61. data/test/controllers/test_fueling_controller.rb +61 -0
  62. data/test/controllers/test_partner_notification_controller.rb +60 -0
  63. data/test/controllers/test_shell_api_platform_security_authentication_controller.rb +36 -0
  64. data/test/controllers/test_station_locator_controller.rb +44 -0
  65. data/test/http_response_catcher.rb +19 -0
  66. metadata +185 -0
@@ -0,0 +1,70 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # FinaliseFuelingRequestProductsItems Model.
8
+ class FinaliseFuelingRequestProductsItems < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :product_id
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :product_name
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Float]
22
+ attr_accessor :unit_price
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['product_id'] = 'productId'
28
+ @_hash['product_name'] = 'productName'
29
+ @_hash['unit_price'] = 'unitPrice'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ product_id
37
+ product_name
38
+ unit_price
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(product_id = SKIP,
48
+ product_name = SKIP,
49
+ unit_price = SKIP)
50
+ @product_id = product_id unless product_id == SKIP
51
+ @product_name = product_name unless product_name == SKIP
52
+ @unit_price = unit_price unless unit_price == SKIP
53
+ end
54
+
55
+ # Creates an instance of the object from a hash.
56
+ def self.from_hash(hash)
57
+ return nil unless hash
58
+
59
+ # Extract variables from the hash.
60
+ product_id = hash.key?('productId') ? hash['productId'] : SKIP
61
+ product_name = hash.key?('productName') ? hash['productName'] : SKIP
62
+ unit_price = hash.key?('unitPrice') ? hash['unitPrice'] : SKIP
63
+
64
+ # Create object from extracted values.
65
+ FinaliseFuelingRequestProductsItems.new(product_id,
66
+ product_name,
67
+ unit_price)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,59 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # LoyaltyDetails Model.
8
+ class LoyaltyDetails < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The user’s Loyalty card number. Although this is optional the expectation
13
+ # is that if this is specified then loyaltyType must also be specified
14
+ # @return [String]
15
+ attr_accessor :loyalty_id
16
+
17
+ # Loyalty type being used, associated to the loyalty ID being passed.
18
+ # Possible values are 'Shell'
19
+ # @return [String]
20
+ attr_accessor :loyalty_type
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['loyalty_id'] = 'loyaltyId'
26
+ @_hash['loyalty_type'] = 'loyaltyType'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ []
33
+ end
34
+
35
+ # An array for nullable fields
36
+ def self.nullables
37
+ []
38
+ end
39
+
40
+ def initialize(loyalty_id = nil,
41
+ loyalty_type = nil)
42
+ @loyalty_id = loyalty_id
43
+ @loyalty_type = loyalty_type
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ loyalty_id = hash.key?('loyaltyId') ? hash['loyaltyId'] : nil
52
+ loyalty_type = hash.key?('loyaltyType') ? hash['loyaltyType'] : nil
53
+
54
+ # Create object from extracted values.
55
+ LoyaltyDetails.new(loyalty_id,
56
+ loyalty_type)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,134 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # MobilePaymentRegistrationRequest Model.
8
+ class MobilePaymentRegistrationRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Unique Reference ID the DPAN is registered to. The Reference ID has been
13
+ # implemented to accept normal alphanumeric characters plus the following
14
+ # ‘special characters’&colon; dot, underscore and hyphen. The following
15
+ # characters are not acceptable&colon; , / @ ! &num; & * ()
16
+ # @return [String]
17
+ attr_accessor :reference_id
18
+
19
+ # Original card PAN (generated on creation of Card (see Card Order Service))
20
+ # @return [String]
21
+ attr_accessor :pan
22
+
23
+ # Expiry Date associated with the PAN in format YYMM.
24
+ # @return [String]
25
+ attr_accessor :pan_expiry
26
+
27
+ # Specifies how many months the DPAN should be valid for. If not present,
28
+ # the Token Server determines the expiry date using its default algorithm.
29
+ # Note that the Token Server might not respect this value and use configured
30
+ # business rules to override the requested validity period
31
+ # @return [Integer]
32
+ attr_accessor :period
33
+
34
+ # In Shell, a Payer can have several accounts (representing company
35
+ # branches, divisions or generally different cost-centers that a customer
36
+ # wants to group cards on). You can specify this property or the
37
+ # AccountNumber.
38
+ # @return [String]
39
+ attr_accessor :account_id
40
+
41
+ # The Payer Id, or the Customer Id of the Payment Customer. In Shell, a
42
+ # Payer is a customer belonging to a specific market geography. A Payer can
43
+ # have several Accounts; each account can then have different groups of
44
+ # cards.
45
+ # @return [String]
46
+ attr_accessor :payer_id
47
+
48
+ # The ID of the Collecting Company (in GFN), also known as Shell Code of the
49
+ # selected payer. This property is mandatory if the ColCoCode code is not
50
+ # passed
51
+ # @return [String]
52
+ attr_accessor :col_co_id
53
+
54
+ # Array of Colco Ids
55
+ # @return [Array[CollectingCompany]]
56
+ attr_accessor :collecting_companies
57
+
58
+ # A mapping from model property names to API property names.
59
+ def self.names
60
+ @_hash = {} if @_hash.nil?
61
+ @_hash['reference_id'] = 'referenceId'
62
+ @_hash['pan'] = 'pan'
63
+ @_hash['pan_expiry'] = 'panExpiry'
64
+ @_hash['period'] = 'period'
65
+ @_hash['account_id'] = 'AccountId'
66
+ @_hash['payer_id'] = 'PayerId'
67
+ @_hash['col_co_id'] = 'ColCoId'
68
+ @_hash['collecting_companies'] = 'CollectingCompanies'
69
+ @_hash
70
+ end
71
+
72
+ # An array for optional fields
73
+ def self.optionals
74
+ []
75
+ end
76
+
77
+ # An array for nullable fields
78
+ def self.nullables
79
+ []
80
+ end
81
+
82
+ def initialize(reference_id = nil,
83
+ pan = nil,
84
+ pan_expiry = nil,
85
+ period = nil,
86
+ account_id = nil,
87
+ payer_id = nil,
88
+ col_co_id = nil,
89
+ collecting_companies = nil)
90
+ @reference_id = reference_id
91
+ @pan = pan
92
+ @pan_expiry = pan_expiry
93
+ @period = period
94
+ @account_id = account_id
95
+ @payer_id = payer_id
96
+ @col_co_id = col_co_id
97
+ @collecting_companies = collecting_companies
98
+ end
99
+
100
+ # Creates an instance of the object from a hash.
101
+ def self.from_hash(hash)
102
+ return nil unless hash
103
+
104
+ # Extract variables from the hash.
105
+ reference_id = hash.key?('referenceId') ? hash['referenceId'] : nil
106
+ pan = hash.key?('pan') ? hash['pan'] : nil
107
+ pan_expiry = hash.key?('panExpiry') ? hash['panExpiry'] : nil
108
+ period = hash.key?('period') ? hash['period'] : nil
109
+ account_id = hash.key?('AccountId') ? hash['AccountId'] : nil
110
+ payer_id = hash.key?('PayerId') ? hash['PayerId'] : nil
111
+ col_co_id = hash.key?('ColCoId') ? hash['ColCoId'] : nil
112
+ # Parameter is an array, so we need to iterate through it
113
+ collecting_companies = nil
114
+ unless hash['CollectingCompanies'].nil?
115
+ collecting_companies = []
116
+ hash['CollectingCompanies'].each do |structure|
117
+ collecting_companies << (CollectingCompany.from_hash(structure) if structure)
118
+ end
119
+ end
120
+
121
+ collecting_companies = nil unless hash.key?('CollectingCompanies')
122
+
123
+ # Create object from extracted values.
124
+ MobilePaymentRegistrationRequest.new(reference_id,
125
+ pan,
126
+ pan_expiry,
127
+ period,
128
+ account_id,
129
+ payer_id,
130
+ col_co_id,
131
+ collecting_companies)
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,81 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # MppAccesTokenResponse Model.
8
+ class MppAccesTokenResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # It is the token used in the requests that required to authenticate an
13
+ # user.
14
+ # @return [String]
15
+ attr_accessor :access_token
16
+
17
+ # type of token provided
18
+ # @return [String]
19
+ attr_accessor :token_type
20
+
21
+ # validity of the access token in seconds
22
+ # @return [Integer]
23
+ attr_accessor :expires_in
24
+
25
+ # scope for the authentication protocol
26
+ # @return [String]
27
+ attr_accessor :scope
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['access_token'] = 'access_token'
33
+ @_hash['token_type'] = 'token_type'
34
+ @_hash['expires_in'] = 'expires_in'
35
+ @_hash['scope'] = 'scope'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def self.optionals
41
+ %w[
42
+ access_token
43
+ token_type
44
+ expires_in
45
+ scope
46
+ ]
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(access_token = SKIP,
55
+ token_type = 'bearer',
56
+ expires_in = SKIP,
57
+ scope = 'basic openid')
58
+ @access_token = access_token unless access_token == SKIP
59
+ @token_type = token_type unless token_type == SKIP
60
+ @expires_in = expires_in unless expires_in == SKIP
61
+ @scope = scope unless scope == SKIP
62
+ end
63
+
64
+ # Creates an instance of the object from a hash.
65
+ def self.from_hash(hash)
66
+ return nil unless hash
67
+
68
+ # Extract variables from the hash.
69
+ access_token = hash.key?('access_token') ? hash['access_token'] : SKIP
70
+ token_type = hash['token_type'] ||= 'bearer'
71
+ expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
72
+ scope = hash['scope'] ||= 'basic openid'
73
+
74
+ # Create object from extracted values.
75
+ MppAccesTokenResponse.new(access_token,
76
+ token_type,
77
+ expires_in,
78
+ scope)
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,94 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # MppError Model.
8
+ class MppError < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Descriptive, human readable error message. Description of the error (e.g.
13
+ # This field is required and must to be between 1 and 255 characters long)
14
+ # @return [String]
15
+ attr_accessor :message
16
+
17
+ # Additional classification specific for each error type e.g. 'noStock'. The
18
+ # nature of the issue (e.g. missing)
19
+ # @return [String]
20
+ attr_accessor :reason
21
+
22
+ # Identifier of the related object e.g. '1'. The field/attribute with an
23
+ # issue (e.g. First Name)
24
+ # @return [String]
25
+ attr_accessor :subject
26
+
27
+ # Type of the object related to the error e.g. 'entry'. The item it relates
28
+ # to (e.g. Parameter)
29
+ # @return [String]
30
+ attr_accessor :subject_type
31
+
32
+ # Type of the error e.g. 'LowStockError', 'Validation Error'
33
+ # @return [String]
34
+ attr_accessor :type
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ @_hash = {} if @_hash.nil?
39
+ @_hash['message'] = 'message'
40
+ @_hash['reason'] = 'reason'
41
+ @_hash['subject'] = 'subject'
42
+ @_hash['subject_type'] = 'subjectType'
43
+ @_hash['type'] = 'type'
44
+ @_hash
45
+ end
46
+
47
+ # An array for optional fields
48
+ def self.optionals
49
+ %w[
50
+ message
51
+ reason
52
+ subject
53
+ subject_type
54
+ type
55
+ ]
56
+ end
57
+
58
+ # An array for nullable fields
59
+ def self.nullables
60
+ []
61
+ end
62
+
63
+ def initialize(message = SKIP,
64
+ reason = SKIP,
65
+ subject = SKIP,
66
+ subject_type = SKIP,
67
+ type = SKIP)
68
+ @message = message unless message == SKIP
69
+ @reason = reason unless reason == SKIP
70
+ @subject = subject unless subject == SKIP
71
+ @subject_type = subject_type unless subject_type == SKIP
72
+ @type = type unless type == SKIP
73
+ end
74
+
75
+ # Creates an instance of the object from a hash.
76
+ def self.from_hash(hash)
77
+ return nil unless hash
78
+
79
+ # Extract variables from the hash.
80
+ message = hash.key?('message') ? hash['message'] : SKIP
81
+ reason = hash.key?('reason') ? hash['reason'] : SKIP
82
+ subject = hash.key?('subject') ? hash['subject'] : SKIP
83
+ subject_type = hash.key?('subjectType') ? hash['subjectType'] : SKIP
84
+ type = hash.key?('type') ? hash['type'] : SKIP
85
+
86
+ # Create object from extracted values.
87
+ MppError.new(message,
88
+ reason,
89
+ subject,
90
+ subject_type,
91
+ type)
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,73 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # MppTokenRequestBody Model.
8
+ class MppTokenRequestBody < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # In OAuth 2.0, the term grant type refers to the way an application gets an
13
+ # access token. OAuth 2.0 defines several grant types, including the
14
+ # authorization code flow.
15
+ # @return [String]
16
+ attr_accessor :grant_type
17
+
18
+ # After registering your app, you will receive a client ID and a client
19
+ # secret. The client ID is considered public information, and is used to
20
+ # build login URLs, or included in Javascript source code on a page.
21
+ # @return [String]
22
+ attr_accessor :client_id
23
+
24
+ # After registering your app, you will receive a client ID and a client
25
+ # secret. The client ID is considered public information, and is used to
26
+ # build login URLs, or included in Javascript source code on a page. The
27
+ # client secret must be kept confidential.
28
+ # @return [String]
29
+ attr_accessor :client_secret
30
+
31
+ # A mapping from model property names to API property names.
32
+ def self.names
33
+ @_hash = {} if @_hash.nil?
34
+ @_hash['grant_type'] = 'grant_type'
35
+ @_hash['client_id'] = 'client_id'
36
+ @_hash['client_secret'] = 'client_secret'
37
+ @_hash
38
+ end
39
+
40
+ # An array for optional fields
41
+ def self.optionals
42
+ []
43
+ end
44
+
45
+ # An array for nullable fields
46
+ def self.nullables
47
+ []
48
+ end
49
+
50
+ def initialize(grant_type = nil,
51
+ client_id = nil,
52
+ client_secret = nil)
53
+ @grant_type = grant_type
54
+ @client_id = client_id
55
+ @client_secret = client_secret
56
+ end
57
+
58
+ # Creates an instance of the object from a hash.
59
+ def self.from_hash(hash)
60
+ return nil unless hash
61
+
62
+ # Extract variables from the hash.
63
+ grant_type = hash.key?('grant_type') ? hash['grant_type'] : nil
64
+ client_id = hash.key?('client_id') ? hash['client_id'] : nil
65
+ client_secret = hash.key?('client_secret') ? hash['client_secret'] : nil
66
+
67
+ # Create object from extracted values.
68
+ MppTokenRequestBody.new(grant_type,
69
+ client_id,
70
+ client_secret)
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,73 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # OauthTokenPostRequestBody Model.
8
+ class OauthTokenPostRequestBody < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # In OAuth 2.0, the term grant typee refers to the way an application gets
13
+ # an access token. OAuth 2.0 defines several grant types, including the
14
+ # authorization code flow.
15
+ # @return [String]
16
+ attr_accessor :grant_type
17
+
18
+ # After registering your app, you will receive a client ID and a client
19
+ # secret. The client ID is considered public information, and is used to
20
+ # build login URLs, or included in Javascript source code on a page.
21
+ # @return [String]
22
+ attr_accessor :client_id
23
+
24
+ # After registering your app, you will receive a client ID and a client
25
+ # secret. The client ID is considered public information, and is used to
26
+ # build login URLs, or included in Javascript source code on a page. The
27
+ # client secret must be kept confidential.
28
+ # @return [String]
29
+ attr_accessor :client_secret
30
+
31
+ # A mapping from model property names to API property names.
32
+ def self.names
33
+ @_hash = {} if @_hash.nil?
34
+ @_hash['grant_type'] = 'grant_type'
35
+ @_hash['client_id'] = 'client_id'
36
+ @_hash['client_secret'] = 'client_secret'
37
+ @_hash
38
+ end
39
+
40
+ # An array for optional fields
41
+ def self.optionals
42
+ []
43
+ end
44
+
45
+ # An array for nullable fields
46
+ def self.nullables
47
+ []
48
+ end
49
+
50
+ def initialize(grant_type = 'client_credentials',
51
+ client_id = 'SOFflRakNlwnWlxfOXQ4GHDVyqGawuKA',
52
+ client_secret = 'cRnWgw7gACqM3gVS')
53
+ @grant_type = grant_type
54
+ @client_id = client_id
55
+ @client_secret = client_secret
56
+ end
57
+
58
+ # Creates an instance of the object from a hash.
59
+ def self.from_hash(hash)
60
+ return nil unless hash
61
+
62
+ # Extract variables from the hash.
63
+ grant_type = hash['grant_type'] ||= 'client_credentials'
64
+ client_id = hash['client_id'] ||= 'SOFflRakNlwnWlxfOXQ4GHDVyqGawuKA'
65
+ client_secret = hash['client_secret'] ||= 'cRnWgw7gACqM3gVS'
66
+
67
+ # Create object from extracted values.
68
+ OauthTokenPostRequestBody.new(grant_type,
69
+ client_id,
70
+ client_secret)
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,73 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # PartnerTokenRequestBody Model.
8
+ class PartnerTokenRequestBody < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # In OAuth 2.0, the term grant typee refers to the way an application gets
13
+ # an access token. OAuth 2.0 defines several grant types, including the
14
+ # authorization code flow.
15
+ # @return [String]
16
+ attr_accessor :grant_type
17
+
18
+ # After registering your app, you will receive a client ID and a client
19
+ # secret. The client ID is considered public information, and is used to
20
+ # build login URLs, or included in Javascript source code on a page.
21
+ # @return [String]
22
+ attr_accessor :client_id
23
+
24
+ # After registering your app, you will receive a client ID and a client
25
+ # secret. The client ID is considered public information, and is used to
26
+ # build login URLs, or included in Javascript source code on a page. The
27
+ # client secret must be kept confidential.
28
+ # @return [String]
29
+ attr_accessor :client_secret
30
+
31
+ # A mapping from model property names to API property names.
32
+ def self.names
33
+ @_hash = {} if @_hash.nil?
34
+ @_hash['grant_type'] = 'grant_type'
35
+ @_hash['client_id'] = 'client_id'
36
+ @_hash['client_secret'] = 'client_secret'
37
+ @_hash
38
+ end
39
+
40
+ # An array for optional fields
41
+ def self.optionals
42
+ []
43
+ end
44
+
45
+ # An array for nullable fields
46
+ def self.nullables
47
+ []
48
+ end
49
+
50
+ def initialize(grant_type = 'client_credentials',
51
+ client_id = 'SOFflRakNlwnWlxfOXQ4GHDVyqGawuKA',
52
+ client_secret = 'cRnWgw7gACqM3gVS')
53
+ @grant_type = grant_type
54
+ @client_id = client_id
55
+ @client_secret = client_secret
56
+ end
57
+
58
+ # Creates an instance of the object from a hash.
59
+ def self.from_hash(hash)
60
+ return nil unless hash
61
+
62
+ # Extract variables from the hash.
63
+ grant_type = hash['grant_type'] ||= 'client_credentials'
64
+ client_id = hash['client_id'] ||= 'SOFflRakNlwnWlxfOXQ4GHDVyqGawuKA'
65
+ client_secret = hash['client_secret'] ||= 'cRnWgw7gACqM3gVS'
66
+
67
+ # Create object from extracted values.
68
+ PartnerTokenRequestBody.new(grant_type,
69
+ client_id,
70
+ client_secret)
71
+ end
72
+ end
73
+ end