splitit-apimatic-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 (87) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +154 -0
  4. data/bin/console +15 -0
  5. data/lib/splitit_web_api_v4/api_helper.rb +10 -0
  6. data/lib/splitit_web_api_v4/client.rb +83 -0
  7. data/lib/splitit_web_api_v4/configuration.rb +188 -0
  8. data/lib/splitit_web_api_v4/controllers/base_controller.rb +60 -0
  9. data/lib/splitit_web_api_v4/controllers/installment_plan_controller.rb +242 -0
  10. data/lib/splitit_web_api_v4/controllers/o_auth_authorization_controller.rb +42 -0
  11. data/lib/splitit_web_api_v4/exceptions/api_error_response_exception.rb +51 -0
  12. data/lib/splitit_web_api_v4/exceptions/api_exception.rb +21 -0
  13. data/lib/splitit_web_api_v4/exceptions/o_auth_provider_exception.rb +64 -0
  14. data/lib/splitit_web_api_v4/http/auth/api_key.rb +52 -0
  15. data/lib/splitit_web_api_v4/http/auth/o_auth2.rb +156 -0
  16. data/lib/splitit_web_api_v4/http/http_call_back.rb +10 -0
  17. data/lib/splitit_web_api_v4/http/http_method_enum.rb +10 -0
  18. data/lib/splitit_web_api_v4/http/http_request.rb +10 -0
  19. data/lib/splitit_web_api_v4/http/http_response.rb +10 -0
  20. data/lib/splitit_web_api_v4/http/proxy_settings.rb +22 -0
  21. data/lib/splitit_web_api_v4/models/amount_data.rb +70 -0
  22. data/lib/splitit_web_api_v4/models/api_error_model.rb +93 -0
  23. data/lib/splitit_web_api_v4/models/apr_data.rb +70 -0
  24. data/lib/splitit_web_api_v4/models/authorization_status_enum.rb +40 -0
  25. data/lib/splitit_web_api_v4/models/authorize_authorization_data.rb +154 -0
  26. data/lib/splitit_web_api_v4/models/authorize_request.rb +115 -0
  27. data/lib/splitit_web_api_v4/models/authorize_response.rb +221 -0
  28. data/lib/splitit_web_api_v4/models/base_model.rb +110 -0
  29. data/lib/splitit_web_api_v4/models/billing_address_data.rb +111 -0
  30. data/lib/splitit_web_api_v4/models/card_details.rb +108 -0
  31. data/lib/splitit_web_api_v4/models/card_validity_request.rb +62 -0
  32. data/lib/splitit_web_api_v4/models/card_validity_response.rb +80 -0
  33. data/lib/splitit_web_api_v4/models/checkout_url_data.rb +80 -0
  34. data/lib/splitit_web_api_v4/models/content_segment.rb +90 -0
  35. data/lib/splitit_web_api_v4/models/external_provider_types_enum.rb +48 -0
  36. data/lib/splitit_web_api_v4/models/inline_content.rb +71 -0
  37. data/lib/splitit_web_api_v4/models/installment_item.rb +101 -0
  38. data/lib/splitit_web_api_v4/models/installment_plan_details_response.rb +280 -0
  39. data/lib/splitit_web_api_v4/models/installment_plan_search_details_response.rb +71 -0
  40. data/lib/splitit_web_api_v4/models/installment_plan_search_request.rb +79 -0
  41. data/lib/splitit_web_api_v4/models/installment_plan_status_enum.rb +72 -0
  42. data/lib/splitit_web_api_v4/models/installment_status_enum.rb +60 -0
  43. data/lib/splitit_web_api_v4/models/masked_card_details.rb +82 -0
  44. data/lib/splitit_web_api_v4/models/metadata_item.rb +71 -0
  45. data/lib/splitit_web_api_v4/models/o_auth_provider_error_enum.rb +62 -0
  46. data/lib/splitit_web_api_v4/models/o_auth_scope_o_auth2_enum.rb +26 -0
  47. data/lib/splitit_web_api_v4/models/o_auth_token.rb +96 -0
  48. data/lib/splitit_web_api_v4/models/offer_item.rb +164 -0
  49. data/lib/splitit_web_api_v4/models/offers_billing_address.rb +108 -0
  50. data/lib/splitit_web_api_v4/models/offers_card_details.rb +108 -0
  51. data/lib/splitit_web_api_v4/models/offers_merchant_details.rb +82 -0
  52. data/lib/splitit_web_api_v4/models/offers_payment_method.rb +66 -0
  53. data/lib/splitit_web_api_v4/models/offers_payment_method_response.rb +88 -0
  54. data/lib/splitit_web_api_v4/models/offers_request.rb +145 -0
  55. data/lib/splitit_web_api_v4/models/offers_response.rb +156 -0
  56. data/lib/splitit_web_api_v4/models/offers_shopper_details.rb +112 -0
  57. data/lib/splitit_web_api_v4/models/offers_store_location.rb +108 -0
  58. data/lib/splitit_web_api_v4/models/payment_link_request.rb +195 -0
  59. data/lib/splitit_web_api_v4/models/payment_link_response.rb +107 -0
  60. data/lib/splitit_web_api_v4/models/payment_method.rb +66 -0
  61. data/lib/splitit_web_api_v4/models/payment_method_data.rb +78 -0
  62. data/lib/splitit_web_api_v4/models/payment_method_type_enum.rb +26 -0
  63. data/lib/splitit_web_api_v4/models/pis_error_codes_enum.rb +1021 -0
  64. data/lib/splitit_web_api_v4/models/plan_authorization_data.rb +172 -0
  65. data/lib/splitit_web_api_v4/models/plan_links_data.rb +91 -0
  66. data/lib/splitit_web_api_v4/models/plan_status_enum.rb +48 -0
  67. data/lib/splitit_web_api_v4/models/processing_data.rb +63 -0
  68. data/lib/splitit_web_api_v4/models/purchase_method_enum.rb +52 -0
  69. data/lib/splitit_web_api_v4/models/redirect_urls.rb +81 -0
  70. data/lib/splitit_web_api_v4/models/refund_item.rb +136 -0
  71. data/lib/splitit_web_api_v4/models/refund_request.rb +70 -0
  72. data/lib/splitit_web_api_v4/models/refund_response.rb +105 -0
  73. data/lib/splitit_web_api_v4/models/shipping_status_enum.rb +40 -0
  74. data/lib/splitit_web_api_v4/models/shopper_details_data.rb +113 -0
  75. data/lib/splitit_web_api_v4/models/three_ds_authentication_data.rb +90 -0
  76. data/lib/splitit_web_api_v4/models/three_ds_execute.rb +62 -0
  77. data/lib/splitit_web_api_v4/models/three_ds_redirect_data.rb +93 -0
  78. data/lib/splitit_web_api_v4/models/three_ds_request_data.rb +84 -0
  79. data/lib/splitit_web_api_v4/models/update_offers_payment_method.rb +66 -0
  80. data/lib/splitit_web_api_v4/models/update_offers_request.rb +105 -0
  81. data/lib/splitit_web_api_v4/models/update_order_request.rb +104 -0
  82. data/lib/splitit_web_api_v4/models/update_order_response.rb +126 -0
  83. data/lib/splitit_web_api_v4/models/validation_error.rb +71 -0
  84. data/lib/splitit_web_api_v4/utilities/date_time_helper.rb +11 -0
  85. data/lib/splitit_web_api_v4/utilities/file_wrapper.rb +28 -0
  86. data/lib/splitit_web_api_v4.rb +108 -0
  87. metadata +170 -0
@@ -0,0 +1,71 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # InstallmentPlanSearchDetailsResponse Model.
8
+ class InstallmentPlanSearchDetailsResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[InstallmentPlanDetailsResponse]]
14
+ attr_accessor :plan_list
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['plan_list'] = 'PlanList'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ plan_list
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(plan_list = SKIP)
36
+ @plan_list = plan_list unless plan_list == SKIP
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ # Parameter is an array, so we need to iterate through it
45
+ plan_list = nil
46
+ unless hash['PlanList'].nil?
47
+ plan_list = []
48
+ hash['PlanList'].each do |structure|
49
+ plan_list << (InstallmentPlanDetailsResponse.from_hash(structure) if structure)
50
+ end
51
+ end
52
+
53
+ plan_list = SKIP unless hash.key?('PlanList')
54
+
55
+ # Create object from extracted values.
56
+ InstallmentPlanSearchDetailsResponse.new(plan_list)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} plan_list: #{@plan_list}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} plan_list: #{@plan_list.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,79 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # InstallmentPlanSearchRequest Model.
8
+ class InstallmentPlanSearchRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[String]]
14
+ attr_accessor :installment_plan_numbers
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Array[String]]
18
+ attr_accessor :merchant_order_reference_ids
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['installment_plan_numbers'] = 'InstallmentPlanNumbers'
24
+ @_hash['merchant_order_reference_ids'] = 'MerchantOrderReferenceIds'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ installment_plan_numbers
32
+ merchant_order_reference_ids
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(installment_plan_numbers = SKIP,
42
+ merchant_order_reference_ids = SKIP)
43
+ @installment_plan_numbers = installment_plan_numbers unless installment_plan_numbers == SKIP
44
+ unless merchant_order_reference_ids == SKIP
45
+ @merchant_order_reference_ids =
46
+ merchant_order_reference_ids
47
+ end
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ installment_plan_numbers =
56
+ hash.key?('InstallmentPlanNumbers') ? hash['InstallmentPlanNumbers'] : SKIP
57
+ merchant_order_reference_ids =
58
+ hash.key?('MerchantOrderReferenceIds') ? hash['MerchantOrderReferenceIds'] : SKIP
59
+
60
+ # Create object from extracted values.
61
+ InstallmentPlanSearchRequest.new(installment_plan_numbers,
62
+ merchant_order_reference_ids)
63
+ end
64
+
65
+ # Provides a human-readable string representation of the object.
66
+ def to_s
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} installment_plan_numbers: #{@installment_plan_numbers},"\
69
+ " merchant_order_reference_ids: #{@merchant_order_reference_ids}>"
70
+ end
71
+
72
+ # Provides a debugging-friendly string with detailed object information.
73
+ def inspect
74
+ class_name = self.class.name.split('::').last
75
+ "<#{class_name} installment_plan_numbers: #{@installment_plan_numbers.inspect},"\
76
+ " merchant_order_reference_ids: #{@merchant_order_reference_ids.inspect}>"
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,72 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # InstallmentPlanStatus.
8
+ class InstallmentPlanStatusEnum
9
+ INSTALLMENT_PLAN_STATUS_ENUM = [
10
+ # TODO: Write general description for NONE
11
+ NONE = 'None'.freeze,
12
+
13
+ # TODO: Write general description for PENDINGAPPROVAL
14
+ PENDINGAPPROVAL = 'PendingApproval'.freeze,
15
+
16
+ # TODO: Write general description for PENDINGMERCHANTSHIPMENTNOTICE
17
+ PENDINGMERCHANTSHIPMENTNOTICE = 'PendingMerchantShipmentNotice'.freeze,
18
+
19
+ # TODO: Write general description for INPROGRESS
20
+ INPROGRESS = 'InProgress'.freeze,
21
+
22
+ # TODO: Write general description for DELETED
23
+ DELETED = 'Deleted'.freeze,
24
+
25
+ # TODO: Write general description for CLEARED
26
+ CLEARED = 'Cleared'.freeze,
27
+
28
+ # TODO: Write general description for PENDINGPAYMENTUPDATE
29
+ PENDINGPAYMENTUPDATE = 'PendingPaymentUpdate'.freeze,
30
+
31
+ # TODO: Write general description for CANCELED
32
+ CANCELED = 'Canceled'.freeze,
33
+
34
+ # TODO: Write general description for DELAYED
35
+ DELAYED = 'Delayed'.freeze,
36
+
37
+ # TODO: Write general description for INITIALIZING
38
+ INITIALIZING = 'Initializing'.freeze,
39
+
40
+ # TODO: Write general description for ALLSTATUSES
41
+ ALLSTATUSES = 'AllStatuses'.freeze
42
+ ].freeze
43
+
44
+ def self.validate(value)
45
+ return false if value.nil?
46
+
47
+ INSTALLMENT_PLAN_STATUS_ENUM.include?(value)
48
+ end
49
+
50
+ def self.from_value(value, default_value = NONE)
51
+ return default_value if value.nil?
52
+
53
+ str = value.to_s.strip
54
+
55
+ case str.downcase
56
+ when 'none' then NONE
57
+ when 'pendingapproval' then PENDINGAPPROVAL
58
+ when 'pendingmerchantshipmentnotice' then PENDINGMERCHANTSHIPMENTNOTICE
59
+ when 'inprogress' then INPROGRESS
60
+ when 'deleted' then DELETED
61
+ when 'cleared' then CLEARED
62
+ when 'pendingpaymentupdate' then PENDINGPAYMENTUPDATE
63
+ when 'canceled' then CANCELED
64
+ when 'delayed' then DELAYED
65
+ when 'initializing' then INITIALIZING
66
+ when 'allstatuses' then ALLSTATUSES
67
+ else
68
+ default_value
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,60 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # InstallmentStatus.
8
+ class InstallmentStatusEnum
9
+ INSTALLMENT_STATUS_ENUM = [
10
+ # TODO: Write general description for NONE
11
+ NONE = 'None'.freeze,
12
+
13
+ # TODO: Write general description for WAITINGFORPROCESSDATE
14
+ WAITINGFORPROCESSDATE = 'WaitingForProcessDate'.freeze,
15
+
16
+ # TODO: Write general description for FINISHED
17
+ FINISHED = 'Finished'.freeze,
18
+
19
+ # TODO: Write general description for DELETED
20
+ DELETED = 'Deleted'.freeze,
21
+
22
+ # TODO: Write general description for STOPPED
23
+ STOPPED = 'Stopped'.freeze,
24
+
25
+ # TODO: Write general description for CANCELED
26
+ CANCELED = 'Canceled'.freeze,
27
+
28
+ # TODO: Write general description for AWAITINGCAPTURE
29
+ AWAITINGCAPTURE = 'AwaitingCapture'.freeze,
30
+
31
+ # TODO: Write general description for AWAITINGVOID
32
+ AWAITINGVOID = 'AwaitingVoid'.freeze
33
+ ].freeze
34
+
35
+ def self.validate(value)
36
+ return false if value.nil?
37
+
38
+ INSTALLMENT_STATUS_ENUM.include?(value)
39
+ end
40
+
41
+ def self.from_value(value, default_value = NONE)
42
+ return default_value if value.nil?
43
+
44
+ str = value.to_s.strip
45
+
46
+ case str.downcase
47
+ when 'none' then NONE
48
+ when 'waitingforprocessdate' then WAITINGFORPROCESSDATE
49
+ when 'finished' then FINISHED
50
+ when 'deleted' then DELETED
51
+ when 'stopped' then STOPPED
52
+ when 'canceled' then CANCELED
53
+ when 'awaitingcapture' then AWAITINGCAPTURE
54
+ when 'awaitingvoid' then AWAITINGVOID
55
+ else
56
+ default_value
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,82 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # MaskedCardDetails Model.
8
+ class MaskedCardDetails < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :last4_digits
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :bin
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :issuer_name
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['last4_digits'] = 'Last4Digits'
28
+ @_hash['bin'] = 'BIN'
29
+ @_hash['issuer_name'] = 'IssuerName'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ last4_digits
37
+ bin
38
+ issuer_name
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(last4_digits = SKIP, bin = SKIP, issuer_name = SKIP)
48
+ @last4_digits = last4_digits unless last4_digits == SKIP
49
+ @bin = bin unless bin == SKIP
50
+ @issuer_name = issuer_name unless issuer_name == SKIP
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ last4_digits = hash.key?('Last4Digits') ? hash['Last4Digits'] : SKIP
59
+ bin = hash.key?('BIN') ? hash['BIN'] : SKIP
60
+ issuer_name = hash.key?('IssuerName') ? hash['IssuerName'] : SKIP
61
+
62
+ # Create object from extracted values.
63
+ MaskedCardDetails.new(last4_digits,
64
+ bin,
65
+ issuer_name)
66
+ end
67
+
68
+ # Provides a human-readable string representation of the object.
69
+ def to_s
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} last4_digits: #{@last4_digits}, bin: #{@bin}, issuer_name:"\
72
+ " #{@issuer_name}>"
73
+ end
74
+
75
+ # Provides a debugging-friendly string with detailed object information.
76
+ def inspect
77
+ class_name = self.class.name.split('::').last
78
+ "<#{class_name} last4_digits: #{@last4_digits.inspect}, bin: #{@bin.inspect}, issuer_name:"\
79
+ " #{@issuer_name.inspect}>"
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,71 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # MetadataItem Model.
8
+ class MetadataItem < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :key
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :value
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['key'] = 'Key'
24
+ @_hash['value'] = 'Value'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ key
32
+ value
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(key = SKIP, value = SKIP)
42
+ @key = key unless key == SKIP
43
+ @value = value unless value == SKIP
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
+ key = hash.key?('Key') ? hash['Key'] : SKIP
52
+ value = hash.key?('Value') ? hash['Value'] : SKIP
53
+
54
+ # Create object from extracted values.
55
+ MetadataItem.new(key,
56
+ value)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} key: #{@key}, value: #{@value}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} key: #{@key.inspect}, value: #{@value.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,62 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # OAuth 2 Authorization error codes
8
+ class OAuthProviderErrorEnum
9
+ O_AUTH_PROVIDER_ERROR_ENUM = [
10
+ # The request is missing a required parameter, includes an unsupported
11
+ # parameter value (other than grant type), repeats a parameter, includes
12
+ # multiple credentials, utilizes more than one mechanism for
13
+ # authenticating the client, or is otherwise malformed.
14
+ INVALID_REQUEST = 'invalid_request'.freeze,
15
+
16
+ # Client authentication failed (e.g., unknown client, no client
17
+ # authentication included, or unsupported authentication method).
18
+ INVALID_CLIENT = 'invalid_client'.freeze,
19
+
20
+ # The provided authorization grant (e.g., authorization code, resource
21
+ # owner credentials) or refresh token is invalid, expired, revoked, does
22
+ # not match the redirection URI used in the authorization request, or was
23
+ # issued to another client.
24
+ INVALID_GRANT = 'invalid_grant'.freeze,
25
+
26
+ # The authenticated client is not authorized to use this authorization
27
+ # grant type.
28
+ UNAUTHORIZED_CLIENT = 'unauthorized_client'.freeze,
29
+
30
+ # The authorization grant type is not supported by the authorization
31
+ # server.
32
+ UNSUPPORTED_GRANT_TYPE = 'unsupported_grant_type'.freeze,
33
+
34
+ # The requested scope is invalid, unknown, malformed, or exceeds the scope
35
+ # granted by the resource owner.
36
+ INVALID_SCOPE = 'invalid_scope'.freeze
37
+ ].freeze
38
+
39
+ def self.validate(value)
40
+ return false if value.nil?
41
+
42
+ O_AUTH_PROVIDER_ERROR_ENUM.include?(value)
43
+ end
44
+
45
+ def self.from_value(value, default_value = INVALID_REQUEST)
46
+ return default_value if value.nil?
47
+
48
+ str = value.to_s.strip
49
+
50
+ case str.downcase
51
+ when 'invalid_request' then INVALID_REQUEST
52
+ when 'invalid_client' then INVALID_CLIENT
53
+ when 'invalid_grant' then INVALID_GRANT
54
+ when 'unauthorized_client' then UNAUTHORIZED_CLIENT
55
+ when 'unsupported_grant_type' then UNSUPPORTED_GRANT_TYPE
56
+ when 'invalid_scope' then INVALID_SCOPE
57
+ else
58
+ default_value
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,26 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # OAuth 2 scopes supported by the API
8
+ class OAuthScopeOAuth2Enum
9
+ O_AUTH_SCOPE_O_AUTH2_ENUM = [
10
+ # Access to API v4
11
+ API_V4 = 'api.v4'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ O_AUTH_SCOPE_O_AUTH2_ENUM.include?(value)
18
+ end
19
+
20
+ def self.from_value(value, default_value = API_V4)
21
+ return default_value if value.nil?
22
+
23
+ default_value
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,96 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # OAuth 2 Authorization endpoint response
8
+ class OAuthToken < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Access token
13
+ # @return [String]
14
+ attr_accessor :access_token
15
+
16
+ # Type of access token
17
+ # @return [String]
18
+ attr_accessor :token_type
19
+
20
+ # Time in seconds before the access token expires
21
+ # @return [Integer]
22
+ attr_accessor :expires_in
23
+
24
+ # List of scopes granted
25
+ # This is a space-delimited list of strings.
26
+ # @return [String]
27
+ attr_accessor :scope
28
+
29
+ # Time of token expiry as unix timestamp (UTC)
30
+ # @return [Integer]
31
+ attr_accessor :expiry
32
+
33
+ # Refresh token
34
+ # Used to get a new access token when it expires.
35
+ # @return [String]
36
+ attr_accessor :refresh_token
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['access_token'] = 'access_token'
42
+ @_hash['token_type'] = 'token_type'
43
+ @_hash['expires_in'] = 'expires_in'
44
+ @_hash['scope'] = 'scope'
45
+ @_hash['expiry'] = 'expiry'
46
+ @_hash['refresh_token'] = 'refresh_token'
47
+ @_hash
48
+ end
49
+
50
+ # An array for optional fields
51
+ def self.optionals
52
+ %w[
53
+ expires_in
54
+ scope
55
+ expiry
56
+ refresh_token
57
+ ]
58
+ end
59
+
60
+ # An array for nullable fields
61
+ def self.nullables
62
+ []
63
+ end
64
+
65
+ def initialize(access_token = nil, token_type = nil, expires_in = SKIP,
66
+ scope = SKIP, expiry = SKIP, refresh_token = SKIP)
67
+ @access_token = access_token
68
+ @token_type = token_type
69
+ @expires_in = expires_in unless expires_in == SKIP
70
+ @scope = scope unless scope == SKIP
71
+ @expiry = expiry unless expiry == SKIP
72
+ @refresh_token = refresh_token unless refresh_token == 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
+ access_token = hash.key?('access_token') ? hash['access_token'] : nil
81
+ token_type = hash.key?('token_type') ? hash['token_type'] : nil
82
+ expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
83
+ scope = hash.key?('scope') ? hash['scope'] : SKIP
84
+ expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
85
+ refresh_token = hash.key?('refresh_token') ? hash['refresh_token'] : SKIP
86
+
87
+ # Create object from extracted values.
88
+ OAuthToken.new(access_token,
89
+ token_type,
90
+ expires_in,
91
+ scope,
92
+ expiry,
93
+ refresh_token)
94
+ end
95
+ end
96
+ end