apimatic-tql-sdk 0.0.1

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 (77) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +210 -0
  4. data/bin/console +15 -0
  5. data/lib/tql_otr_factoring_data_exchange/api_helper.rb +10 -0
  6. data/lib/tql_otr_factoring_data_exchange/apis/assignments_api.rb +45 -0
  7. data/lib/tql_otr_factoring_data_exchange/apis/base_api.rb +67 -0
  8. data/lib/tql_otr_factoring_data_exchange/apis/documents_api.rb +82 -0
  9. data/lib/tql_otr_factoring_data_exchange/apis/invoices_api.rb +114 -0
  10. data/lib/tql_otr_factoring_data_exchange/apis/loads_api.rb +68 -0
  11. data/lib/tql_otr_factoring_data_exchange/apis/oauth_authorization_api.rb +44 -0
  12. data/lib/tql_otr_factoring_data_exchange/client.rb +104 -0
  13. data/lib/tql_otr_factoring_data_exchange/configuration.rb +164 -0
  14. data/lib/tql_otr_factoring_data_exchange/exceptions/api_exception.rb +21 -0
  15. data/lib/tql_otr_factoring_data_exchange/exceptions/oauth_provider_exception.rb +64 -0
  16. data/lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb +58 -0
  17. data/lib/tql_otr_factoring_data_exchange/http/api_response.rb +19 -0
  18. data/lib/tql_otr_factoring_data_exchange/http/auth/oauth_2.rb +156 -0
  19. data/lib/tql_otr_factoring_data_exchange/http/http_call_back.rb +10 -0
  20. data/lib/tql_otr_factoring_data_exchange/http/http_method_enum.rb +10 -0
  21. data/lib/tql_otr_factoring_data_exchange/http/http_request.rb +10 -0
  22. data/lib/tql_otr_factoring_data_exchange/http/http_response.rb +10 -0
  23. data/lib/tql_otr_factoring_data_exchange/http/proxy_settings.rb +22 -0
  24. data/lib/tql_otr_factoring_data_exchange/logging/configuration/api_logging_configuration.rb +186 -0
  25. data/lib/tql_otr_factoring_data_exchange/logging/sdk_logger.rb +17 -0
  26. data/lib/tql_otr_factoring_data_exchange/models/assignment_request.rb +140 -0
  27. data/lib/tql_otr_factoring_data_exchange/models/assignment_response.rb +126 -0
  28. data/lib/tql_otr_factoring_data_exchange/models/assignment_status.rb +36 -0
  29. data/lib/tql_otr_factoring_data_exchange/models/base64_document.rb +118 -0
  30. data/lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb +107 -0
  31. data/lib/tql_otr_factoring_data_exchange/models/base_model.rb +110 -0
  32. data/lib/tql_otr_factoring_data_exchange/models/carrier.rb +98 -0
  33. data/lib/tql_otr_factoring_data_exchange/models/carrier1.rb +98 -0
  34. data/lib/tql_otr_factoring_data_exchange/models/carrier2.rb +98 -0
  35. data/lib/tql_otr_factoring_data_exchange/models/carrier_input.rb +123 -0
  36. data/lib/tql_otr_factoring_data_exchange/models/carrier_input1.rb +123 -0
  37. data/lib/tql_otr_factoring_data_exchange/models/charge_code.rb +126 -0
  38. data/lib/tql_otr_factoring_data_exchange/models/charge_code_origin.rb +49 -0
  39. data/lib/tql_otr_factoring_data_exchange/models/charge_input.rb +146 -0
  40. data/lib/tql_otr_factoring_data_exchange/models/document.rb +86 -0
  41. data/lib/tql_otr_factoring_data_exchange/models/document_type.rb +288 -0
  42. data/lib/tql_otr_factoring_data_exchange/models/document_upload_metadata.rb +111 -0
  43. data/lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb +137 -0
  44. data/lib/tql_otr_factoring_data_exchange/models/exception_severity.rb +40 -0
  45. data/lib/tql_otr_factoring_data_exchange/models/factoring_company_input.rb +117 -0
  46. data/lib/tql_otr_factoring_data_exchange/models/invoice.rb +223 -0
  47. data/lib/tql_otr_factoring_data_exchange/models/invoice_exception.rb +136 -0
  48. data/lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb +165 -0
  49. data/lib/tql_otr_factoring_data_exchange/models/invoice_search_request.rb +242 -0
  50. data/lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb +124 -0
  51. data/lib/tql_otr_factoring_data_exchange/models/invoice_status.rb +74 -0
  52. data/lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb +193 -0
  53. data/lib/tql_otr_factoring_data_exchange/models/invoice_type.rb +50 -0
  54. data/lib/tql_otr_factoring_data_exchange/models/load.rb +110 -0
  55. data/lib/tql_otr_factoring_data_exchange/models/load_detail.rb +140 -0
  56. data/lib/tql_otr_factoring_data_exchange/models/load_search_request.rb +205 -0
  57. data/lib/tql_otr_factoring_data_exchange/models/load_search_response.rb +124 -0
  58. data/lib/tql_otr_factoring_data_exchange/models/load_status.rb +56 -0
  59. data/lib/tql_otr_factoring_data_exchange/models/location.rb +149 -0
  60. data/lib/tql_otr_factoring_data_exchange/models/oauth_provider_error.rb +62 -0
  61. data/lib/tql_otr_factoring_data_exchange/models/oauth_scope.rb +36 -0
  62. data/lib/tql_otr_factoring_data_exchange/models/oauth_token.rb +96 -0
  63. data/lib/tql_otr_factoring_data_exchange/models/payment.rb +108 -0
  64. data/lib/tql_otr_factoring_data_exchange/models/problem_details.rb +96 -0
  65. data/lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb +109 -0
  66. data/lib/tql_otr_factoring_data_exchange/models/reference_type.rb +90 -0
  67. data/lib/tql_otr_factoring_data_exchange/models/status.rb +44 -0
  68. data/lib/tql_otr_factoring_data_exchange/models/stop_input.rb +121 -0
  69. data/lib/tql_otr_factoring_data_exchange/models/stop_type.rb +62 -0
  70. data/lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb +326 -0
  71. data/lib/tql_otr_factoring_data_exchange/models/submit_invoice_response.rb +107 -0
  72. data/lib/tql_otr_factoring_data_exchange/models/weight_unit.rb +36 -0
  73. data/lib/tql_otr_factoring_data_exchange/utilities/date_time_helper.rb +11 -0
  74. data/lib/tql_otr_factoring_data_exchange/utilities/file_wrapper.rb +28 -0
  75. data/lib/tql_otr_factoring_data_exchange/utilities/union_type_lookup.rb +29 -0
  76. data/lib/tql_otr_factoring_data_exchange.rb +107 -0
  77. metadata +160 -0
@@ -0,0 +1,149 @@
1
+ # tql_otr_factoring_data_exchange
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TqlOtrFactoringDataExchange
7
+ # Physical address of the stop.
8
+ class Location < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Facility or company name at this stop.
13
+ # @return [String]
14
+ attr_accessor :name
15
+
16
+ # Street address line 1.
17
+ # @return [String]
18
+ attr_accessor :address
19
+
20
+ # Street address line 2 (suite, unit, dock, etc.).
21
+ # @return [String]
22
+ attr_accessor :address2
23
+
24
+ # City name.
25
+ # @return [String]
26
+ attr_accessor :city
27
+
28
+ # Two-letter state/province code.
29
+ # @return [String]
30
+ attr_accessor :state
31
+
32
+ # ZIP or postal code.
33
+ # @return [String]
34
+ attr_accessor :postal_code
35
+
36
+ # [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2
37
+ # country code.
38
+ # @return [String]
39
+ attr_accessor :country
40
+
41
+ # A mapping from model property names to API property names.
42
+ def self.names
43
+ @_hash = {} if @_hash.nil?
44
+ @_hash['name'] = 'name'
45
+ @_hash['address'] = 'address'
46
+ @_hash['address2'] = 'address2'
47
+ @_hash['city'] = 'city'
48
+ @_hash['state'] = 'state'
49
+ @_hash['postal_code'] = 'postalCode'
50
+ @_hash['country'] = 'country'
51
+ @_hash
52
+ end
53
+
54
+ # An array for optional fields
55
+ def self.optionals
56
+ %w[
57
+ name
58
+ address
59
+ address2
60
+ city
61
+ state
62
+ postal_code
63
+ country
64
+ ]
65
+ end
66
+
67
+ # An array for nullable fields
68
+ def self.nullables
69
+ %w[
70
+ name
71
+ address2
72
+ ]
73
+ end
74
+
75
+ def initialize(name: SKIP, address: SKIP, address2: SKIP, city: SKIP,
76
+ state: SKIP, postal_code: SKIP, country: 'US',
77
+ additional_properties: nil)
78
+ # Add additional model properties to the instance
79
+ additional_properties = {} if additional_properties.nil?
80
+
81
+ @name = name unless name == SKIP
82
+ @address = address unless address == SKIP
83
+ @address2 = address2 unless address2 == SKIP
84
+ @city = city unless city == SKIP
85
+ @state = state unless state == SKIP
86
+ @postal_code = postal_code unless postal_code == SKIP
87
+ @country = country unless country == SKIP
88
+ @additional_properties = additional_properties
89
+ end
90
+
91
+ # Creates an instance of the object from a hash.
92
+ def self.from_hash(hash)
93
+ return nil unless hash
94
+
95
+ # Extract variables from the hash.
96
+ name = hash.key?('name') ? hash['name'] : SKIP
97
+ address = hash.key?('address') ? hash['address'] : SKIP
98
+ address2 = hash.key?('address2') ? hash['address2'] : SKIP
99
+ city = hash.key?('city') ? hash['city'] : SKIP
100
+ state = hash.key?('state') ? hash['state'] : SKIP
101
+ postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
102
+ country = hash['country'] ||= 'US'
103
+
104
+ # Create a new hash for additional properties, removing known properties.
105
+ new_hash = hash.reject { |k, _| names.value?(k) }
106
+
107
+ additional_properties = APIHelper.get_additional_properties(
108
+ new_hash, proc { |value| value }
109
+ )
110
+
111
+ # Create object from extracted values.
112
+ Location.new(name: name,
113
+ address: address,
114
+ address2: address2,
115
+ city: city,
116
+ state: state,
117
+ postal_code: postal_code,
118
+ country: country,
119
+ additional_properties: additional_properties)
120
+ end
121
+
122
+ # Validates an instance of the object from a given value.
123
+ # @param [Location | Hash] The value against the validation is performed.
124
+ def self.validate(value)
125
+ return true if value.instance_of? self
126
+
127
+ return false unless value.instance_of? Hash
128
+
129
+ true
130
+ end
131
+
132
+ # Provides a human-readable string representation of the object.
133
+ def to_s
134
+ class_name = self.class.name.split('::').last
135
+ "<#{class_name} name: #{@name}, address: #{@address}, address2: #{@address2}, city:"\
136
+ " #{@city}, state: #{@state}, postal_code: #{@postal_code}, country: #{@country},"\
137
+ " additional_properties: #{@additional_properties}>"
138
+ end
139
+
140
+ # Provides a debugging-friendly string with detailed object information.
141
+ def inspect
142
+ class_name = self.class.name.split('::').last
143
+ "<#{class_name} name: #{@name.inspect}, address: #{@address.inspect}, address2:"\
144
+ " #{@address2.inspect}, city: #{@city.inspect}, state: #{@state.inspect}, postal_code:"\
145
+ " #{@postal_code.inspect}, country: #{@country.inspect}, additional_properties:"\
146
+ " #{@additional_properties}>"
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,62 @@
1
+ # tql_otr_factoring_data_exchange
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TqlOtrFactoringDataExchange
7
+ # OAuth 2 Authorization error codes
8
+ class OauthProviderError
9
+ OAUTH_PROVIDER_ERROR = [
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
+ OAUTH_PROVIDER_ERROR.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,36 @@
1
+ # tql_otr_factoring_data_exchange
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TqlOtrFactoringDataExchange
7
+ # OAuth 2 scopes supported by the API
8
+ class OauthScope
9
+ OAUTH_SCOPE = [
10
+ # Submit invoices, upload documents, manage assignments
11
+ FACTORING_WRITE = 'Factoring.Write'.freeze,
12
+
13
+ # Query invoice status, search invoices
14
+ FACTORING_READ = 'Factoring.Read'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ OAUTH_SCOPE.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = FACTORING_WRITE)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'factoring_write' then FACTORING_WRITE
30
+ when 'factoring_read' then FACTORING_READ
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,96 @@
1
+ # tql_otr_factoring_data_exchange
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TqlOtrFactoringDataExchange
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:, token_type:, expires_in: SKIP, scope: SKIP,
66
+ 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: access_token,
89
+ token_type: token_type,
90
+ expires_in: expires_in,
91
+ scope: scope,
92
+ expiry: expiry,
93
+ refresh_token: refresh_token)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,108 @@
1
+ # tql_otr_factoring_data_exchange
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TqlOtrFactoringDataExchange
7
+ # Payment and billing details for this invoice.
8
+ class Payment < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Total invoiced amount.
13
+ # @return [Float]
14
+ attr_accessor :invoice_amount
15
+
16
+ # Amount paid against this invoice so far.
17
+ # @return [Float]
18
+ attr_accessor :paid_amount
19
+
20
+ # [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) currency
21
+ # code.
22
+ # @return [String]
23
+ attr_accessor :currency
24
+
25
+ # Payment due date.
26
+ # @return [Date]
27
+ attr_accessor :due_date
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['invoice_amount'] = 'invoiceAmount'
33
+ @_hash['paid_amount'] = 'paidAmount'
34
+ @_hash['currency'] = 'currency'
35
+ @_hash['due_date'] = 'dueDate'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def self.optionals
41
+ %w[
42
+ invoice_amount
43
+ paid_amount
44
+ currency
45
+ due_date
46
+ ]
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ %w[
52
+ due_date
53
+ ]
54
+ end
55
+
56
+ def initialize(invoice_amount: SKIP, paid_amount: SKIP, currency: SKIP,
57
+ due_date: SKIP, additional_properties: nil)
58
+ # Add additional model properties to the instance
59
+ additional_properties = {} if additional_properties.nil?
60
+
61
+ @invoice_amount = invoice_amount unless invoice_amount == SKIP
62
+ @paid_amount = paid_amount unless paid_amount == SKIP
63
+ @currency = currency unless currency == SKIP
64
+ @due_date = due_date unless due_date == SKIP
65
+ @additional_properties = additional_properties
66
+ end
67
+
68
+ # Creates an instance of the object from a hash.
69
+ def self.from_hash(hash)
70
+ return nil unless hash
71
+
72
+ # Extract variables from the hash.
73
+ invoice_amount = hash.key?('invoiceAmount') ? hash['invoiceAmount'] : SKIP
74
+ paid_amount = hash.key?('paidAmount') ? hash['paidAmount'] : SKIP
75
+ currency = hash.key?('currency') ? hash['currency'] : SKIP
76
+ due_date = hash.key?('dueDate') ? hash['dueDate'] : SKIP
77
+
78
+ # Create a new hash for additional properties, removing known properties.
79
+ new_hash = hash.reject { |k, _| names.value?(k) }
80
+
81
+ additional_properties = APIHelper.get_additional_properties(
82
+ new_hash, proc { |value| value }
83
+ )
84
+
85
+ # Create object from extracted values.
86
+ Payment.new(invoice_amount: invoice_amount,
87
+ paid_amount: paid_amount,
88
+ currency: currency,
89
+ due_date: due_date,
90
+ additional_properties: additional_properties)
91
+ end
92
+
93
+ # Provides a human-readable string representation of the object.
94
+ def to_s
95
+ class_name = self.class.name.split('::').last
96
+ "<#{class_name} invoice_amount: #{@invoice_amount}, paid_amount: #{@paid_amount}, currency:"\
97
+ " #{@currency}, due_date: #{@due_date}, additional_properties: #{@additional_properties}>"
98
+ end
99
+
100
+ # Provides a debugging-friendly string with detailed object information.
101
+ def inspect
102
+ class_name = self.class.name.split('::').last
103
+ "<#{class_name} invoice_amount: #{@invoice_amount.inspect}, paid_amount:"\
104
+ " #{@paid_amount.inspect}, currency: #{@currency.inspect}, due_date: #{@due_date.inspect},"\
105
+ " additional_properties: #{@additional_properties}>"
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,96 @@
1
+ # tql_otr_factoring_data_exchange
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TqlOtrFactoringDataExchange
7
+ # [RFC 7807](https://datatracker.ietf.org/doc/html/rfc7807) Problem Details
8
+ # response returned for validation errors and other non-success outcomes.
9
+ class ProblemDetails < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Short, human-readable summary of the problem type.
14
+ # @return [String]
15
+ attr_accessor :title
16
+
17
+ # HTTP status code.
18
+ # @return [Integer]
19
+ attr_accessor :status
20
+
21
+ # Detailed, human-readable explanation specific to this occurrence.
22
+ # @return [String]
23
+ attr_accessor :detail
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['title'] = 'title'
29
+ @_hash['status'] = 'status'
30
+ @_hash['detail'] = 'detail'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ %w[
37
+ title
38
+ status
39
+ detail
40
+ ]
41
+ end
42
+
43
+ # An array for nullable fields
44
+ def self.nullables
45
+ []
46
+ end
47
+
48
+ def initialize(title: SKIP, status: SKIP, detail: SKIP,
49
+ additional_properties: nil)
50
+ # Add additional model properties to the instance
51
+ additional_properties = {} if additional_properties.nil?
52
+
53
+ @title = title unless title == SKIP
54
+ @status = status unless status == SKIP
55
+ @detail = detail unless detail == SKIP
56
+ @additional_properties = additional_properties
57
+ end
58
+
59
+ # Creates an instance of the object from a hash.
60
+ def self.from_hash(hash)
61
+ return nil unless hash
62
+
63
+ # Extract variables from the hash.
64
+ title = hash.key?('title') ? hash['title'] : SKIP
65
+ status = hash.key?('status') ? hash['status'] : SKIP
66
+ detail = hash.key?('detail') ? hash['detail'] : SKIP
67
+
68
+ # Create a new hash for additional properties, removing known properties.
69
+ new_hash = hash.reject { |k, _| names.value?(k) }
70
+
71
+ additional_properties = APIHelper.get_additional_properties(
72
+ new_hash, proc { |value| value }
73
+ )
74
+
75
+ # Create object from extracted values.
76
+ ProblemDetails.new(title: title,
77
+ status: status,
78
+ detail: detail,
79
+ additional_properties: additional_properties)
80
+ end
81
+
82
+ # Provides a human-readable string representation of the object.
83
+ def to_s
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} title: #{@title}, status: #{@status}, detail: #{@detail},"\
86
+ " additional_properties: #{@additional_properties}>"
87
+ end
88
+
89
+ # Provides a debugging-friendly string with detailed object information.
90
+ def inspect
91
+ class_name = self.class.name.split('::').last
92
+ "<#{class_name} title: #{@title.inspect}, status: #{@status.inspect}, detail:"\
93
+ " #{@detail.inspect}, additional_properties: #{@additional_properties}>"
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,109 @@
1
+ # tql_otr_factoring_data_exchange
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TqlOtrFactoringDataExchange
7
+ # A reference number using [EDI
8
+ # 210](https://www.stedi.com/edi/x12/transaction-set/210) Reference
9
+ # Identification Qualifier codes to cross-reference the invoice with the TQL
10
+ # load.
11
+ class ReferenceNumberInput < BaseModel
12
+ SKIP = Object.new
13
+ private_constant :SKIP
14
+
15
+ # Reference number qualifier. Values follow [EDI
16
+ # 210](https://www.stedi.com/edi/x12/transaction-set/210) / [ANSI
17
+ # X12](https://www.x12.org/) Reference Identification Qualifier codes.
18
+ # @return [ReferenceType]
19
+ attr_accessor :reference_type
20
+
21
+ # The reference number value.
22
+ # @return [String]
23
+ attr_accessor :value
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['reference_type'] = 'referenceType'
29
+ @_hash['value'] = 'value'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ []
36
+ end
37
+
38
+ # An array for nullable fields
39
+ def self.nullables
40
+ []
41
+ end
42
+
43
+ def initialize(reference_type:, value:, additional_properties: nil)
44
+ # Add additional model properties to the instance
45
+ additional_properties = {} if additional_properties.nil?
46
+
47
+ @reference_type = reference_type
48
+ @value = value
49
+ @additional_properties = additional_properties
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ reference_type = hash.key?('referenceType') ? hash['referenceType'] : nil
58
+ value = hash.key?('value') ? hash['value'] : nil
59
+
60
+ # Create a new hash for additional properties, removing known properties.
61
+ new_hash = hash.reject { |k, _| names.value?(k) }
62
+
63
+ additional_properties = APIHelper.get_additional_properties(
64
+ new_hash, proc { |value| value }
65
+ )
66
+
67
+ # Create object from extracted values.
68
+ ReferenceNumberInput.new(reference_type: reference_type,
69
+ value: value,
70
+ additional_properties: additional_properties)
71
+ end
72
+
73
+ # Validates an instance of the object from a given value.
74
+ # @param [ReferenceNumberInput | Hash] The value against the validation is performed.
75
+ def self.validate(value)
76
+ if value.instance_of? self
77
+ return (
78
+ APIHelper.valid_type?(value.reference_type,
79
+ ->(val) { ReferenceType.validate(val) }) and
80
+ APIHelper.valid_type?(value.value,
81
+ ->(val) { val.instance_of? String })
82
+ )
83
+ end
84
+
85
+ return false unless value.instance_of? Hash
86
+
87
+ (
88
+ APIHelper.valid_type?(value['referenceType'],
89
+ ->(val) { ReferenceType.validate(val) }) and
90
+ APIHelper.valid_type?(value['value'],
91
+ ->(val) { val.instance_of? String })
92
+ )
93
+ end
94
+
95
+ # Provides a human-readable string representation of the object.
96
+ def to_s
97
+ class_name = self.class.name.split('::').last
98
+ "<#{class_name} reference_type: #{@reference_type}, value: #{@value},"\
99
+ " additional_properties: #{@additional_properties}>"
100
+ end
101
+
102
+ # Provides a debugging-friendly string with detailed object information.
103
+ def inspect
104
+ class_name = self.class.name.split('::').last
105
+ "<#{class_name} reference_type: #{@reference_type.inspect}, value: #{@value.inspect},"\
106
+ " additional_properties: #{@additional_properties}>"
107
+ end
108
+ end
109
+ end