pnap_payments_api 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.
@@ -0,0 +1,250 @@
1
+ =begin
2
+ #Payments API
3
+
4
+ #Payments API are currently designed to fetch Transactions only.
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PaymentsApi
17
+ # Transaction's metadata.
18
+ class TransactionMetadata
19
+ # The Invoice ID that this transaction pertains to.
20
+ attr_accessor :invoice_id
21
+
22
+ # A user-friendly reference number assigned to the invoice that this transaction pertains to.
23
+ attr_accessor :invoice_number
24
+
25
+ # Whether this transaction was triggered by an auto charge or not.
26
+ attr_accessor :is_auto_charge
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'invoice_id' => :'invoiceId',
32
+ :'invoice_number' => :'invoiceNumber',
33
+ :'is_auto_charge' => :'isAutoCharge'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'invoice_id' => :'String',
46
+ :'invoice_number' => :'String',
47
+ :'is_auto_charge' => :'Boolean'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PaymentsApi::TransactionMetadata` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::TransactionMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'invoice_id')
73
+ self.invoice_id = attributes[:'invoice_id']
74
+ else
75
+ self.invoice_id = nil
76
+ end
77
+
78
+ if attributes.key?(:'invoice_number')
79
+ self.invoice_number = attributes[:'invoice_number']
80
+ end
81
+
82
+ if attributes.key?(:'is_auto_charge')
83
+ self.is_auto_charge = attributes[:'is_auto_charge']
84
+ else
85
+ self.is_auto_charge = nil
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
93
+ invalid_properties = Array.new
94
+ if @invoice_id.nil?
95
+ invalid_properties.push('invalid value for "invoice_id", invoice_id cannot be nil.')
96
+ end
97
+
98
+ if @is_auto_charge.nil?
99
+ invalid_properties.push('invalid value for "is_auto_charge", is_auto_charge cannot be nil.')
100
+ end
101
+
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ warn '[DEPRECATED] the `valid?` method is obsolete'
109
+ return false if @invoice_id.nil?
110
+ return false if @is_auto_charge.nil?
111
+ true
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ invoice_id == o.invoice_id &&
120
+ invoice_number == o.invoice_number &&
121
+ is_auto_charge == o.is_auto_charge
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Integer] Hash code
132
+ def hash
133
+ [invoice_id, invoice_number, is_auto_charge].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ attributes = attributes.transform_keys(&:to_sym)
142
+ transformed_hash = {}
143
+ openapi_types.each_pair do |key, type|
144
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[attribute_map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
151
+ end
152
+ elsif !attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
154
+ end
155
+ end
156
+ new(transformed_hash)
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def self._deserialize(type, value)
164
+ case type.to_sym
165
+ when :Time
166
+ Time.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :Boolean
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ # models (e.g. Pet) or oneOf
197
+ klass = PaymentsApi.const_get(type)
198
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end
@@ -0,0 +1,19 @@
1
+ =begin
2
+ #Payments API
3
+
4
+ #Payments API are currently designed to fetch Transactions only.
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ def get_version()
14
+ return File.read(File.expand_path('../../../VERSION', __FILE__)).strip
15
+ end
16
+
17
+ module PaymentsApi
18
+ VERSION = get_version()
19
+ end
@@ -0,0 +1,46 @@
1
+ =begin
2
+ #Payments API
3
+
4
+ #Payments API are currently designed to fetch Transactions only.
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'pnap_payments_api/api_client'
15
+ require 'pnap_payments_api/api_error'
16
+ require 'pnap_payments_api/version'
17
+ require 'pnap_payments_api/configuration'
18
+
19
+ # Models
20
+ require 'pnap_payments_api/models/card_payment_method_details'
21
+ require 'pnap_payments_api/models/error'
22
+ require 'pnap_payments_api/models/paginated_response'
23
+ require 'pnap_payments_api/models/paginated_transactions'
24
+ require 'pnap_payments_api/models/transaction'
25
+ require 'pnap_payments_api/models/transaction_metadata'
26
+
27
+ # APIs
28
+ require 'pnap_payments_api/api/transactions_api'
29
+
30
+ module PaymentsApi
31
+ class << self
32
+ # Customize default settings for the SDK using block.
33
+ # PaymentsApi.configure do |config|
34
+ # config.username = "xxx"
35
+ # config.password = "xxx"
36
+ # end
37
+ # If no block given, return the default Configuration object.
38
+ def configure
39
+ if block_given?
40
+ yield(Configuration.default)
41
+ else
42
+ Configuration.default
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,39 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ =begin
4
+ #Payments API
5
+
6
+ #Payments API are currently designed to fetch Transactions only.
7
+
8
+ The version of the OpenAPI document: 0.1
9
+ Contact: support@phoenixnap.com
10
+ Generated by: https://openapi-generator.tech
11
+ OpenAPI Generator version: 7.2.0
12
+
13
+ =end
14
+
15
+ $:.push File.expand_path("../lib", __FILE__)
16
+ require "pnap_payments_api/version"
17
+
18
+ Gem::Specification.new do |s|
19
+ s.name = "pnap_payments_api"
20
+ s.version = PaymentsApi::VERSION
21
+ s.platform = Gem::Platform::RUBY
22
+ s.authors = ["PhoenixNAP"]
23
+ s.email = ["support@phoenixnap.com"]
24
+ s.homepage = "https://phoenixnap.com/bare-metal-cloud"
25
+ s.summary = "Payments API Ruby Gem"
26
+ s.description = "Payments API Ruby Gem"
27
+ s.license = "MPL-2.0"
28
+ s.required_ruby_version = ">= 2.7"
29
+ s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" }
30
+
31
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
32
+
33
+ s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
34
+
35
+ s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
36
+ s.test_files = `find spec/*`.split("\n")
37
+ s.executables = []
38
+ s.require_paths = ["lib"]
39
+ end
@@ -0,0 +1,64 @@
1
+ =begin
2
+ #Payments API
3
+
4
+ #Payments API are currently designed to fetch Transactions only.
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for PaymentsApi::TransactionsApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'TransactionsApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = PaymentsApi::TransactionsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of TransactionsApi' do
30
+ it 'should create an instance of TransactionsApi' do
31
+ expect(@api_instance).to be_instance_of(PaymentsApi::TransactionsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for transaction_id_get
36
+ # Get Transaction.
37
+ # Get transaction details.
38
+ # @param transaction_id The transaction identifier.
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Transaction]
41
+ describe 'transaction_id_get test' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
44
+ end
45
+ end
46
+
47
+ # unit tests for transactions_get
48
+ # Get Transactions.
49
+ # A paginated list of client&#39;s transactions.
50
+ # @param [Hash] opts the optional parameters
51
+ # @option opts [Integer] :limit The limit of the number of results returned. The number of records returned may be smaller than the limit.
52
+ # @option opts [Integer] :offset The number of items to skip in the results.
53
+ # @option opts [String] :sort_direction Sort Given Field depending on the desired direction. Default sorting is descending.
54
+ # @option opts [String] :sort_field If a sortField is requested, pagination will be done after sorting. Default sorting is by date.
55
+ # @option opts [Time] :from From the date and time (inclusive) to filter transactions by.
56
+ # @option opts [Time] :to To the date and time (inclusive) to filter transactions by.
57
+ # @return [PaginatedTransactions]
58
+ describe 'transactions_get test' do
59
+ it 'should work' do
60
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
61
+ end
62
+ end
63
+
64
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #Payments API
3
+
4
+ #Payments API are currently designed to fetch Transactions only.
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for PaymentsApi::CardPaymentMethodDetails
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe PaymentsApi::CardPaymentMethodDetails do
21
+ let(:instance) { PaymentsApi::CardPaymentMethodDetails.new }
22
+
23
+ describe 'test an instance of CardPaymentMethodDetails' do
24
+ it 'should create an instance of CardPaymentMethodDetails' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(PaymentsApi::CardPaymentMethodDetails)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "card_type"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "last_four_digits"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #Payments API
3
+
4
+ #Payments API are currently designed to fetch Transactions only.
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for PaymentsApi::Error
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe PaymentsApi::Error do
21
+ let(:instance) { PaymentsApi::Error.new }
22
+
23
+ describe 'test an instance of Error' do
24
+ it 'should create an instance of Error' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(PaymentsApi::Error)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "message"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "validation_errors"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,48 @@
1
+ =begin
2
+ #Payments API
3
+
4
+ #Payments API are currently designed to fetch Transactions only.
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for PaymentsApi::PaginatedResponse
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe PaymentsApi::PaginatedResponse do
21
+ let(:instance) { PaymentsApi::PaginatedResponse.new }
22
+
23
+ describe 'test an instance of PaginatedResponse' do
24
+ it 'should create an instance of PaginatedResponse' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(PaymentsApi::PaginatedResponse)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "limit"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "offset"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ describe 'test attribute "total"' do
43
+ it 'should work' do
44
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
45
+ end
46
+ end
47
+
48
+ end
@@ -0,0 +1,54 @@
1
+ =begin
2
+ #Payments API
3
+
4
+ #Payments API are currently designed to fetch Transactions only.
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for PaymentsApi::PaginatedTransactions
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe PaymentsApi::PaginatedTransactions do
21
+ let(:instance) { PaymentsApi::PaginatedTransactions.new }
22
+
23
+ describe 'test an instance of PaginatedTransactions' do
24
+ it 'should create an instance of PaginatedTransactions' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(PaymentsApi::PaginatedTransactions)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "results"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "limit"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ describe 'test attribute "offset"' do
43
+ it 'should work' do
44
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
45
+ end
46
+ end
47
+
48
+ describe 'test attribute "total"' do
49
+ it 'should work' do
50
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
51
+ end
52
+ end
53
+
54
+ end
@@ -0,0 +1,48 @@
1
+ =begin
2
+ #Payments API
3
+
4
+ #Payments API are currently designed to fetch Transactions only.
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for PaymentsApi::TransactionMetadata
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe PaymentsApi::TransactionMetadata do
21
+ let(:instance) { PaymentsApi::TransactionMetadata.new }
22
+
23
+ describe 'test an instance of TransactionMetadata' do
24
+ it 'should create an instance of TransactionMetadata' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(PaymentsApi::TransactionMetadata)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "invoice_id"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "invoice_number"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ describe 'test attribute "is_auto_charge"' do
43
+ it 'should work' do
44
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
45
+ end
46
+ end
47
+
48
+ end