tpaga 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tpaga.rb +28 -21
- data/lib/tpaga/api/charge_api.rb +133 -100
- data/lib/tpaga/api/chargeback_api.rb +88 -0
- data/lib/tpaga/api/credit_card_api.rb +220 -0
- data/lib/tpaga/api/customer_api.rb +84 -326
- data/lib/tpaga/api/davi_plata_api.rb +340 -0
- data/lib/tpaga/models/address.rb +47 -54
- data/lib/tpaga/models/api_error.rb +38 -0
- data/lib/tpaga/models/api_errors_item.rb +60 -0
- data/lib/tpaga/models/base_object.rb +85 -0
- data/lib/tpaga/models/billing_address.rb +76 -0
- data/lib/tpaga/models/city.rb +40 -51
- data/lib/tpaga/models/credit_card.rb +148 -0
- data/lib/tpaga/models/credit_card_charge.rb +116 -0
- data/lib/tpaga/models/credit_card_create.rb +76 -0
- data/lib/tpaga/models/customer.rb +68 -63
- data/lib/tpaga/models/davi_plata.rb +92 -0
- data/lib/tpaga/models/davi_plata_charge.rb +108 -0
- data/lib/tpaga/models/davi_plata_chargeback.rb +60 -0
- data/lib/tpaga/models/davi_plata_verification.rb +44 -0
- data/lib/tpaga/monkey.rb +1 -1
- data/lib/tpaga/swagger.rb +64 -87
- data/lib/tpaga/swagger/configuration.rb +24 -27
- data/lib/tpaga/swagger/request.rb +247 -192
- data/lib/tpaga/swagger/response.rb +52 -53
- data/lib/tpaga/swagger/version.rb +3 -4
- data/tpaga.gemspec +8 -9
- metadata +20 -12
- data/lib/tpaga/models/billingaddress.rb +0 -75
- data/lib/tpaga/models/charge.rb +0 -91
- data/lib/tpaga/models/creditcard.rb +0 -107
- data/lib/tpaga/models/creditcardcreate.rb +0 -75
@@ -0,0 +1,38 @@
|
|
1
|
+
module Tpaga
|
2
|
+
#
|
3
|
+
class ApiError < BaseObject
|
4
|
+
attr_accessor :errors
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'errors' => :'errors'
|
11
|
+
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
# attribute type
|
16
|
+
def self.swagger_types
|
17
|
+
{
|
18
|
+
:'errors' => :'array[ApiErrorsItem]'
|
19
|
+
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(attributes = {})
|
24
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
25
|
+
|
26
|
+
# convert string to symbol for hash key
|
27
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
28
|
+
|
29
|
+
|
30
|
+
if attributes[:'errors']
|
31
|
+
if (value = attributes[:'errors']).is_a?(Array)
|
32
|
+
@errors = value
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Tpaga
|
2
|
+
#
|
3
|
+
class ApiErrorsItem < BaseObject
|
4
|
+
attr_accessor :object, :field, :rejected_value, :message
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'object' => :'object',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'field' => :'field',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'rejected_value' => :'rejected-value',
|
17
|
+
|
18
|
+
#
|
19
|
+
:'message' => :'message'
|
20
|
+
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# attribute type
|
25
|
+
def self.swagger_types
|
26
|
+
{
|
27
|
+
:'object' => :'string',
|
28
|
+
:'field' => :'string',
|
29
|
+
:'rejected_value' => :'string',
|
30
|
+
:'message' => :'string'
|
31
|
+
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(attributes = {})
|
36
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
37
|
+
|
38
|
+
# convert string to symbol for hash key
|
39
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
40
|
+
|
41
|
+
|
42
|
+
if attributes[:'object']
|
43
|
+
@object = attributes[:'object']
|
44
|
+
end
|
45
|
+
|
46
|
+
if attributes[:'field']
|
47
|
+
@field = attributes[:'field']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes[:'rejected-value']
|
51
|
+
@rejected_value = attributes[:'rejected-value']
|
52
|
+
end
|
53
|
+
|
54
|
+
if attributes[:'message']
|
55
|
+
@message = attributes[:'message']
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module Tpaga
|
2
|
+
# base class containing fundamental method such as to_hash, build_from_hash and more
|
3
|
+
class BaseObject
|
4
|
+
|
5
|
+
# return the object in the form of hash
|
6
|
+
def to_body
|
7
|
+
body = {}
|
8
|
+
self.class.attribute_map.each_pair do |key, value|
|
9
|
+
body[value] = self.send(key) unless self.send(key).nil?
|
10
|
+
end
|
11
|
+
body
|
12
|
+
end
|
13
|
+
|
14
|
+
# build the object from hash
|
15
|
+
def build_from_hash(attributes)
|
16
|
+
return nil unless attributes.is_a?(Hash)
|
17
|
+
self.class.swagger_types.each_pair do |key, type|
|
18
|
+
if type =~ /^array\[(.*)\]/i
|
19
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
20
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
21
|
+
else
|
22
|
+
#TODO show warning in debug mode
|
23
|
+
end
|
24
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
25
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
26
|
+
else
|
27
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
34
|
+
def _deserialize(type, value)
|
35
|
+
case type.to_sym
|
36
|
+
when :DateTime
|
37
|
+
DateTime.parse(value)
|
38
|
+
when :string
|
39
|
+
value.to_s
|
40
|
+
when :int
|
41
|
+
value.to_i
|
42
|
+
when :number
|
43
|
+
value.to_i
|
44
|
+
when :double
|
45
|
+
value.to_f
|
46
|
+
when :boolean
|
47
|
+
if (value =~ /^(true|t|yes|y|1)$/i or value)
|
48
|
+
true
|
49
|
+
else
|
50
|
+
false
|
51
|
+
end
|
52
|
+
else # model
|
53
|
+
_model = Tpaga.const_get(type).new
|
54
|
+
_model.build_from_hash(value)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# to_body is an alias to to_body (backward compatibility)
|
59
|
+
def to_hash
|
60
|
+
hash = {}
|
61
|
+
self.class.attribute_map.each_pair do |key, value|
|
62
|
+
if self.send(key).is_a?(Array)
|
63
|
+
next if self.send(key).empty?
|
64
|
+
hash[value] = self.send(key).select{|v| !v.nil?}.map{ |v| _to_hash v} unless self.send(key).nil?
|
65
|
+
else
|
66
|
+
unless (_tmp_value = _to_hash self.send(key)).nil?
|
67
|
+
hash[value] = _tmp_value
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
hash
|
72
|
+
end
|
73
|
+
|
74
|
+
# Method to output non-array value in the form of hash
|
75
|
+
# For object, use to_hash. Otherwise, just return the value
|
76
|
+
def _to_hash(value)
|
77
|
+
if value.respond_to? :to_hash
|
78
|
+
value.to_hash
|
79
|
+
else
|
80
|
+
value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Tpaga
|
2
|
+
#
|
3
|
+
class BillingAddress < BaseObject
|
4
|
+
attr_accessor :address_line1, :address_line2, :city, :state, :postal_code, :country
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'address_line1' => :'addressLine1',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'address_line2' => :'addressLine2',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'city' => :'city',
|
17
|
+
|
18
|
+
#
|
19
|
+
:'state' => :'state',
|
20
|
+
|
21
|
+
#
|
22
|
+
:'postal_code' => :'postalCode',
|
23
|
+
|
24
|
+
#
|
25
|
+
:'country' => :'country'
|
26
|
+
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# attribute type
|
31
|
+
def self.swagger_types
|
32
|
+
{
|
33
|
+
:'address_line1' => :'string',
|
34
|
+
:'address_line2' => :'string',
|
35
|
+
:'city' => :'string',
|
36
|
+
:'state' => :'string',
|
37
|
+
:'postal_code' => :'string',
|
38
|
+
:'country' => :'string'
|
39
|
+
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def initialize(attributes = {})
|
44
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
45
|
+
|
46
|
+
# convert string to symbol for hash key
|
47
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
48
|
+
|
49
|
+
|
50
|
+
if attributes[:'addressLine1']
|
51
|
+
@address_line1 = attributes[:'addressLine1']
|
52
|
+
end
|
53
|
+
|
54
|
+
if attributes[:'addressLine2']
|
55
|
+
@address_line2 = attributes[:'addressLine2']
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes[:'city']
|
59
|
+
@city = attributes[:'city']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes[:'state']
|
63
|
+
@state = attributes[:'state']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes[:'postalCode']
|
67
|
+
@postal_code = attributes[:'postalCode']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes[:'country']
|
71
|
+
@country = attributes[:'country']
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/tpaga/models/city.rb
CHANGED
@@ -1,63 +1,52 @@
|
|
1
|
-
require 'date'
|
2
|
-
|
3
1
|
module Tpaga
|
4
|
-
|
5
|
-
|
2
|
+
#
|
3
|
+
class City < BaseObject
|
4
|
+
attr_accessor :name, :state, :country
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'name' => :'name',
|
11
|
+
|
12
|
+
# ISO 3166-2 code for state
|
13
|
+
:'state' => :'state',
|
14
|
+
|
15
|
+
# ISO 3166-1 Alpha 2 code for country
|
16
|
+
:'country' => :'country'
|
17
|
+
|
18
|
+
}
|
19
|
+
end
|
6
20
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
21
|
+
# attribute type
|
22
|
+
def self.swagger_types
|
23
|
+
{
|
24
|
+
:'name' => :'string',
|
25
|
+
:'state' => :'string',
|
26
|
+
:'country' => :'string'
|
27
|
+
|
28
|
+
}
|
29
|
+
end
|
13
30
|
|
14
|
-
}
|
15
|
-
|
31
|
+
def initialize(attributes = {})
|
32
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
16
33
|
|
17
|
-
|
18
|
-
|
34
|
+
# convert string to symbol for hash key
|
35
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
19
36
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
# Morph attribute keys into undescored rubyish style
|
25
|
-
if self.class.attribute_map[:"country"]
|
26
|
-
@country = attributes["country"]
|
27
|
-
end
|
28
|
-
if self.class.attribute_map[:"name"]
|
29
|
-
@name = attributes["name"]
|
37
|
+
|
38
|
+
if attributes[:'name']
|
39
|
+
@name = attributes[:'name']
|
30
40
|
end
|
31
|
-
|
32
|
-
|
41
|
+
|
42
|
+
if attributes[:'state']
|
43
|
+
@state = attributes[:'state']
|
33
44
|
end
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
def to_body
|
39
|
-
body = {}
|
40
|
-
self.class.attribute_map.each_pair do |key, value|
|
41
|
-
next if self.send(key).nil?
|
42
|
-
|
43
|
-
if self.send(key).respond_to? :to_body
|
44
|
-
body[value] = self.send(key).to_body
|
45
|
-
elsif self.send(key).kind_of?(Array)
|
46
|
-
body[value] = []
|
47
|
-
self.send(key).each do |arr|
|
48
|
-
if arr.respond_to? :to_body
|
49
|
-
body[value] << arr.to_body
|
50
|
-
else
|
51
|
-
body[value] << arr
|
52
|
-
end
|
53
|
-
end
|
54
|
-
else
|
55
|
-
body[value] = self.send(key)
|
45
|
+
|
46
|
+
if attributes[:'country']
|
47
|
+
@country = attributes[:'country']
|
56
48
|
end
|
57
49
|
|
58
50
|
end
|
59
|
-
body
|
60
51
|
end
|
61
52
|
end
|
62
|
-
end
|
63
|
-
|
@@ -0,0 +1,148 @@
|
|
1
|
+
module Tpaga
|
2
|
+
#
|
3
|
+
class CreditCard < BaseObject
|
4
|
+
attr_accessor :id, :bin, :type, :expiration_month, :expiration_year, :card_verification_code, :card_holder_name, :last_four, :customer, :address_line1, :address_line2, :address_city, :address_state, :address_postal_code, :address_country
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'id' => :'id',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'bin' => :'bin',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'type' => :'type',
|
17
|
+
|
18
|
+
#
|
19
|
+
:'expiration_month' => :'expirationMonth',
|
20
|
+
|
21
|
+
#
|
22
|
+
:'expiration_year' => :'expirationYear',
|
23
|
+
|
24
|
+
#
|
25
|
+
:'card_verification_code' => :'cardVerificationCode',
|
26
|
+
|
27
|
+
#
|
28
|
+
:'card_holder_name' => :'cardHolderName',
|
29
|
+
|
30
|
+
#
|
31
|
+
:'last_four' => :'lastFour',
|
32
|
+
|
33
|
+
#
|
34
|
+
:'customer' => :'customer',
|
35
|
+
|
36
|
+
#
|
37
|
+
:'address_line1' => :'addressLine1',
|
38
|
+
|
39
|
+
#
|
40
|
+
:'address_line2' => :'addressLine2',
|
41
|
+
|
42
|
+
#
|
43
|
+
:'address_city' => :'addressCity',
|
44
|
+
|
45
|
+
#
|
46
|
+
:'address_state' => :'addressState',
|
47
|
+
|
48
|
+
#
|
49
|
+
:'address_postal_code' => :'addressPostalCode',
|
50
|
+
|
51
|
+
#
|
52
|
+
:'address_country' => :'addressCountry'
|
53
|
+
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# attribute type
|
58
|
+
def self.swagger_types
|
59
|
+
{
|
60
|
+
:'id' => :'string',
|
61
|
+
:'bin' => :'string',
|
62
|
+
:'type' => :'string',
|
63
|
+
:'expiration_month' => :'string',
|
64
|
+
:'expiration_year' => :'string',
|
65
|
+
:'card_verification_code' => :'string',
|
66
|
+
:'card_holder_name' => :'string',
|
67
|
+
:'last_four' => :'string',
|
68
|
+
:'customer' => :'string',
|
69
|
+
:'address_line1' => :'string',
|
70
|
+
:'address_line2' => :'string',
|
71
|
+
:'address_city' => :'string',
|
72
|
+
:'address_state' => :'string',
|
73
|
+
:'address_postal_code' => :'string',
|
74
|
+
:'address_country' => :'string'
|
75
|
+
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def initialize(attributes = {})
|
80
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
81
|
+
|
82
|
+
# convert string to symbol for hash key
|
83
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
84
|
+
|
85
|
+
|
86
|
+
if attributes[:'id']
|
87
|
+
@id = attributes[:'id']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes[:'bin']
|
91
|
+
@bin = attributes[:'bin']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes[:'type']
|
95
|
+
@type = attributes[:'type']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes[:'expirationMonth']
|
99
|
+
@expiration_month = attributes[:'expirationMonth']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes[:'expirationYear']
|
103
|
+
@expiration_year = attributes[:'expirationYear']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes[:'cardVerificationCode']
|
107
|
+
@card_verification_code = attributes[:'cardVerificationCode']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes[:'cardHolderName']
|
111
|
+
@card_holder_name = attributes[:'cardHolderName']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes[:'lastFour']
|
115
|
+
@last_four = attributes[:'lastFour']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes[:'customer']
|
119
|
+
@customer = attributes[:'customer']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes[:'addressLine1']
|
123
|
+
@address_line1 = attributes[:'addressLine1']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes[:'addressLine2']
|
127
|
+
@address_line2 = attributes[:'addressLine2']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes[:'addressCity']
|
131
|
+
@address_city = attributes[:'addressCity']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes[:'addressState']
|
135
|
+
@address_state = attributes[:'addressState']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes[:'addressPostalCode']
|
139
|
+
@address_postal_code = attributes[:'addressPostalCode']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes[:'addressCountry']
|
143
|
+
@address_country = attributes[:'addressCountry']
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|