tpaga 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/tpaga/api/charge_api.rb +135 -0
- data/lib/tpaga/api/customer_api.rb +368 -0
- data/lib/tpaga/models/address.rb +67 -0
- data/lib/tpaga/models/billingaddress.rb +75 -0
- data/lib/tpaga/models/charge.rb +91 -0
- data/lib/tpaga/models/city.rb +63 -0
- data/lib/tpaga/models/creditcard.rb +107 -0
- data/lib/tpaga/models/creditcardcreate.rb +75 -0
- data/lib/tpaga/models/customer.rb +79 -0
- data/lib/tpaga/monkey.rb +90 -0
- data/lib/tpaga/swagger/configuration.rb +32 -0
- data/lib/tpaga/swagger/request.rb +215 -0
- data/lib/tpaga/swagger/response.rb +71 -0
- data/lib/tpaga/swagger/version.rb +6 -0
- data/lib/tpaga/swagger.rb +99 -0
- data/lib/tpaga.rb +28 -0
- data/tpaga.gemspec +29 -0
- metadata +121 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Tpaga
|
4
|
+
class Charge
|
5
|
+
attr_accessor :amount, :creditCard, :currency, :customer, :description, :id, :orderId, :paid, :paymentTransaction, :taxAmount
|
6
|
+
|
7
|
+
# :internal => :external
|
8
|
+
def self.attribute_map
|
9
|
+
{
|
10
|
+
:amount => :'amount',
|
11
|
+
:creditCard => :'creditCard',
|
12
|
+
:currency => :'currency',
|
13
|
+
:customer => :'customer',
|
14
|
+
:description => :'description',
|
15
|
+
:id => :'id',
|
16
|
+
:orderId => :'orderId',
|
17
|
+
:paid => :'paid',
|
18
|
+
:paymentTransaction => :'paymentTransaction',
|
19
|
+
:taxAmount => :'taxAmount'
|
20
|
+
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(attributes = {})
|
25
|
+
return if attributes.empty?
|
26
|
+
|
27
|
+
# convert hash key from symbol to string
|
28
|
+
# and convert object to hash
|
29
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_s] = Swagger.to_body(v); memo}
|
30
|
+
|
31
|
+
# Morph attribute keys into undescored rubyish style
|
32
|
+
if self.class.attribute_map[:"amount"]
|
33
|
+
@amount = attributes["amount"]
|
34
|
+
end
|
35
|
+
if self.class.attribute_map[:"creditCard"]
|
36
|
+
@creditCard = attributes["creditCard"]
|
37
|
+
end
|
38
|
+
if self.class.attribute_map[:"currency"]
|
39
|
+
@currency = attributes["currency"]
|
40
|
+
end
|
41
|
+
if self.class.attribute_map[:"customer"]
|
42
|
+
@customer = attributes["customer"]
|
43
|
+
end
|
44
|
+
if self.class.attribute_map[:"description"]
|
45
|
+
@description = attributes["description"]
|
46
|
+
end
|
47
|
+
if self.class.attribute_map[:"id"]
|
48
|
+
@id = attributes["id"]
|
49
|
+
end
|
50
|
+
if self.class.attribute_map[:"orderId"]
|
51
|
+
@orderId = attributes["orderId"]
|
52
|
+
end
|
53
|
+
if self.class.attribute_map[:"paid"]
|
54
|
+
@paid = attributes["paid"]
|
55
|
+
end
|
56
|
+
if self.class.attribute_map[:"paymentTransaction"]
|
57
|
+
@paymentTransaction = attributes["paymentTransaction"]
|
58
|
+
end
|
59
|
+
if self.class.attribute_map[:"taxAmount"]
|
60
|
+
@taxAmount = attributes["taxAmount"]
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
def to_body
|
67
|
+
body = {}
|
68
|
+
self.class.attribute_map.each_pair do |key, value|
|
69
|
+
next if self.send(key).nil?
|
70
|
+
|
71
|
+
if self.send(key).respond_to? :to_body
|
72
|
+
body[value] = self.send(key).to_body
|
73
|
+
elsif self.send(key).kind_of?(Array)
|
74
|
+
body[value] = []
|
75
|
+
self.send(key).each do |arr|
|
76
|
+
if arr.respond_to? :to_body
|
77
|
+
body[value] << arr.to_body
|
78
|
+
else
|
79
|
+
body[value] << arr
|
80
|
+
end
|
81
|
+
end
|
82
|
+
else
|
83
|
+
body[value] = self.send(key)
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
body
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Tpaga
|
4
|
+
class City
|
5
|
+
attr_accessor :country, :name, :state
|
6
|
+
|
7
|
+
# :internal => :external
|
8
|
+
def self.attribute_map
|
9
|
+
{
|
10
|
+
:country => :'country',
|
11
|
+
:name => :'name',
|
12
|
+
:state => :'state'
|
13
|
+
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(attributes = {})
|
18
|
+
return if attributes.empty?
|
19
|
+
|
20
|
+
# convert hash key from symbol to string
|
21
|
+
# and convert object to hash
|
22
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_s] = Swagger.to_body(v); memo}
|
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"]
|
30
|
+
end
|
31
|
+
if self.class.attribute_map[:"state"]
|
32
|
+
@state = attributes["state"]
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
end
|
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)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
body
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Tpaga
|
4
|
+
class CreditCard
|
5
|
+
attr_accessor :addressCity, :addressCountry, :addressLine1, :addressLine2, :addressPostalCode, :addressState, :bin, :cardHolderName, :customer, :expirationMonth, :expirationYear, :id, :lastFour, :type
|
6
|
+
|
7
|
+
# :internal => :external
|
8
|
+
def self.attribute_map
|
9
|
+
{
|
10
|
+
:addressCity => :'addressCity',
|
11
|
+
:addressCountry => :'addressCountry',
|
12
|
+
:addressLine1 => :'addressLine1',
|
13
|
+
:addressLine2 => :'addressLine2',
|
14
|
+
:addressPostalCode => :'addressPostalCode',
|
15
|
+
:addressState => :'addressState',
|
16
|
+
:bin => :'bin',
|
17
|
+
:cardHolderName => :'cardHolderName',
|
18
|
+
:customer => :'customer',
|
19
|
+
:expirationMonth => :'expirationMonth',
|
20
|
+
:expirationYear => :'expirationYear',
|
21
|
+
:id => :'id',
|
22
|
+
:lastFour => :'lastFour',
|
23
|
+
:type => :'type'
|
24
|
+
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(attributes = {})
|
29
|
+
return if attributes.empty?
|
30
|
+
|
31
|
+
# convert hash key from symbol to string
|
32
|
+
# and convert object to hash
|
33
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_s] = Swagger.to_body(v); memo}
|
34
|
+
|
35
|
+
# Morph attribute keys into undescored rubyish style
|
36
|
+
if self.class.attribute_map[:"addressCity"]
|
37
|
+
@addressCity = attributes["addressCity"]
|
38
|
+
end
|
39
|
+
if self.class.attribute_map[:"addressCountry"]
|
40
|
+
@addressCountry = attributes["addressCountry"]
|
41
|
+
end
|
42
|
+
if self.class.attribute_map[:"addressLine1"]
|
43
|
+
@addressLine1 = attributes["addressLine1"]
|
44
|
+
end
|
45
|
+
if self.class.attribute_map[:"addressLine2"]
|
46
|
+
@addressLine2 = attributes["addressLine2"]
|
47
|
+
end
|
48
|
+
if self.class.attribute_map[:"addressPostalCode"]
|
49
|
+
@addressPostalCode = attributes["addressPostalCode"]
|
50
|
+
end
|
51
|
+
if self.class.attribute_map[:"addressState"]
|
52
|
+
@addressState = attributes["addressState"]
|
53
|
+
end
|
54
|
+
if self.class.attribute_map[:"bin"]
|
55
|
+
@bin = attributes["bin"]
|
56
|
+
end
|
57
|
+
if self.class.attribute_map[:"cardHolderName"]
|
58
|
+
@cardHolderName = attributes["cardHolderName"]
|
59
|
+
end
|
60
|
+
if self.class.attribute_map[:"customer"]
|
61
|
+
@customer = attributes["customer"]
|
62
|
+
end
|
63
|
+
if self.class.attribute_map[:"expirationMonth"]
|
64
|
+
@expirationMonth = attributes["expirationMonth"]
|
65
|
+
end
|
66
|
+
if self.class.attribute_map[:"expirationYear"]
|
67
|
+
@expirationYear = attributes["expirationYear"]
|
68
|
+
end
|
69
|
+
if self.class.attribute_map[:"id"]
|
70
|
+
@id = attributes["id"]
|
71
|
+
end
|
72
|
+
if self.class.attribute_map[:"lastFour"]
|
73
|
+
@lastFour = attributes["lastFour"]
|
74
|
+
end
|
75
|
+
if self.class.attribute_map[:"type"]
|
76
|
+
@type = attributes["type"]
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
def to_body
|
83
|
+
body = {}
|
84
|
+
self.class.attribute_map.each_pair do |key, value|
|
85
|
+
next if self.send(key).nil?
|
86
|
+
|
87
|
+
if self.send(key).respond_to? :to_body
|
88
|
+
body[value] = self.send(key).to_body
|
89
|
+
elsif self.send(key).kind_of?(Array)
|
90
|
+
body[value] = []
|
91
|
+
self.send(key).each do |arr|
|
92
|
+
if arr.respond_to? :to_body
|
93
|
+
body[value] << arr.to_body
|
94
|
+
else
|
95
|
+
body[value] << arr
|
96
|
+
end
|
97
|
+
end
|
98
|
+
else
|
99
|
+
body[value] = self.send(key)
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
body
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Tpaga
|
4
|
+
class CreditCardCreate
|
5
|
+
attr_accessor :billingAddress, :cardHolderName, :cardVerificationCode, :expirationMonth, :expirationYear, :primaryAccountNumber
|
6
|
+
|
7
|
+
# :internal => :external
|
8
|
+
def self.attribute_map
|
9
|
+
{
|
10
|
+
:billingAddress => :'billingAddress',
|
11
|
+
:cardHolderName => :'cardHolderName',
|
12
|
+
:cardVerificationCode => :'cardVerificationCode',
|
13
|
+
:expirationMonth => :'expirationMonth',
|
14
|
+
:expirationYear => :'expirationYear',
|
15
|
+
:primaryAccountNumber => :'primaryAccountNumber'
|
16
|
+
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(attributes = {})
|
21
|
+
return if attributes.empty?
|
22
|
+
|
23
|
+
# convert hash key from symbol to string
|
24
|
+
# and convert object to hash
|
25
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_s] = Swagger.to_body(v); memo}
|
26
|
+
|
27
|
+
# Morph attribute keys into undescored rubyish style
|
28
|
+
if self.class.attribute_map[:"billingAddress"]
|
29
|
+
@billingAddress = BillingAddress.new(attributes["billingAddress"]) if (attributes["billingAddress"].kind_of? Hash)
|
30
|
+
end
|
31
|
+
if self.class.attribute_map[:"cardHolderName"]
|
32
|
+
@cardHolderName = attributes["cardHolderName"]
|
33
|
+
end
|
34
|
+
if self.class.attribute_map[:"cardVerificationCode"]
|
35
|
+
@cardVerificationCode = attributes["cardVerificationCode"]
|
36
|
+
end
|
37
|
+
if self.class.attribute_map[:"expirationMonth"]
|
38
|
+
@expirationMonth = attributes["expirationMonth"]
|
39
|
+
end
|
40
|
+
if self.class.attribute_map[:"expirationYear"]
|
41
|
+
@expirationYear = attributes["expirationYear"]
|
42
|
+
end
|
43
|
+
if self.class.attribute_map[:"primaryAccountNumber"]
|
44
|
+
@primaryAccountNumber = attributes["primaryAccountNumber"]
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def to_body
|
51
|
+
body = {}
|
52
|
+
self.class.attribute_map.each_pair do |key, value|
|
53
|
+
next if self.send(key).nil?
|
54
|
+
|
55
|
+
if self.send(key).respond_to? :to_body
|
56
|
+
body[value] = self.send(key).to_body
|
57
|
+
elsif self.send(key).kind_of?(Array)
|
58
|
+
body[value] = []
|
59
|
+
self.send(key).each do |arr|
|
60
|
+
if arr.respond_to? :to_body
|
61
|
+
body[value] << arr.to_body
|
62
|
+
else
|
63
|
+
body[value] << arr
|
64
|
+
end
|
65
|
+
end
|
66
|
+
else
|
67
|
+
body[value] = self.send(key)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
body
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Tpaga
|
4
|
+
class Customer
|
5
|
+
attr_accessor :address, :email, :firstName, :gender, :id, :lastName, :phone
|
6
|
+
|
7
|
+
# :internal => :external
|
8
|
+
def self.attribute_map
|
9
|
+
{
|
10
|
+
:address => :'address',
|
11
|
+
:email => :'email',
|
12
|
+
:firstName => :'firstName',
|
13
|
+
:gender => :'gender',
|
14
|
+
:id => :'id',
|
15
|
+
:lastName => :'lastName',
|
16
|
+
:phone => :'phone'
|
17
|
+
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(attributes = {})
|
22
|
+
return if attributes.empty?
|
23
|
+
|
24
|
+
# convert hash key from symbol to string
|
25
|
+
# and convert object to hash
|
26
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_s] = Swagger.to_body(v); memo}
|
27
|
+
|
28
|
+
# Morph attribute keys into undescored rubyish style
|
29
|
+
if self.class.attribute_map[:"address"]
|
30
|
+
@address = Address.new(attributes["address"]) if (attributes["address"].kind_of? Hash)
|
31
|
+
end
|
32
|
+
if self.class.attribute_map[:"email"]
|
33
|
+
@email = attributes["email"]
|
34
|
+
end
|
35
|
+
if self.class.attribute_map[:"firstName"]
|
36
|
+
@firstName = attributes["firstName"]
|
37
|
+
end
|
38
|
+
if self.class.attribute_map[:"gender"]
|
39
|
+
@gender = attributes["gender"]
|
40
|
+
end
|
41
|
+
if self.class.attribute_map[:"id"]
|
42
|
+
@id = attributes["id"]
|
43
|
+
end
|
44
|
+
if self.class.attribute_map[:"lastName"]
|
45
|
+
@lastName = attributes["lastName"]
|
46
|
+
end
|
47
|
+
if self.class.attribute_map[:"phone"]
|
48
|
+
@phone = attributes["phone"]
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def to_body
|
55
|
+
body = {}
|
56
|
+
self.class.attribute_map.each_pair do |key, value|
|
57
|
+
next if self.send(key).nil?
|
58
|
+
|
59
|
+
if self.send(key).respond_to? :to_body
|
60
|
+
body[value] = self.send(key).to_body
|
61
|
+
elsif self.send(key).kind_of?(Array)
|
62
|
+
body[value] = []
|
63
|
+
self.send(key).each do |arr|
|
64
|
+
if arr.respond_to? :to_body
|
65
|
+
body[value] << arr.to_body
|
66
|
+
else
|
67
|
+
body[value] << arr
|
68
|
+
end
|
69
|
+
end
|
70
|
+
else
|
71
|
+
body[value] = self.send(key)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
body
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
data/lib/tpaga/monkey.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# module Swagger
|
2
|
+
class Object
|
3
|
+
|
4
|
+
unless Object.method_defined? :blank?
|
5
|
+
def blank?
|
6
|
+
respond_to?(:empty?) ? empty? : !self
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
unless Object.method_defined? :present?
|
11
|
+
def present?
|
12
|
+
!blank?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class String
|
19
|
+
|
20
|
+
unless String.method_defined? :underscore
|
21
|
+
def underscore
|
22
|
+
self.gsub(/::/, '/').
|
23
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
24
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
25
|
+
tr("-", "_").
|
26
|
+
downcase
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
unless String.method_defined? :camelize
|
31
|
+
def camelize(first_letter_in_uppercase = true)
|
32
|
+
if first_letter_in_uppercase != :lower
|
33
|
+
self.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
34
|
+
else
|
35
|
+
self.to_s[0].chr.downcase + camelize(self)[1..-1]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
class Hash
|
43
|
+
|
44
|
+
unless Hash.method_defined? :stringify_keys
|
45
|
+
def stringify_keys
|
46
|
+
inject({}) do |options, (key, value)|
|
47
|
+
options[key.to_s] = value
|
48
|
+
options
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
unless Hash.method_defined? :stringify_keys!
|
54
|
+
def stringify_keys!
|
55
|
+
self.replace(self.stringify_keys)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
unless Hash.method_defined? :symbolize_keys
|
60
|
+
def symbolize_keys
|
61
|
+
inject({}) do |options, (key, value)|
|
62
|
+
options[(key.to_sym rescue key) || key] = value
|
63
|
+
options
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
unless Hash.method_defined? :symbolize_keys!
|
69
|
+
def symbolize_keys!
|
70
|
+
self.replace(self.symbolize_keys)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
unless Hash.method_defined? :symbolize_and_underscore_keys
|
75
|
+
def symbolize_and_underscore_keys
|
76
|
+
inject({}) do |options, (key, value)|
|
77
|
+
options[(key.to_s.underscore.to_sym rescue key) || key] = value
|
78
|
+
options
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
unless Hash.method_defined? :symbolize_and_underscore_keys!
|
84
|
+
def symbolize_and_underscore_keys!
|
85
|
+
self.replace(self.symbolize_and_underscore_keys)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
# end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Tpaga
|
2
|
+
module Swagger
|
3
|
+
|
4
|
+
class Configuration
|
5
|
+
|
6
|
+
attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger, :inject_format, :force_ending_format, :camelize_params, :api_key_type, :api_key_name, :api_key_prefix
|
7
|
+
|
8
|
+
# Defaults go in here..
|
9
|
+
def initialize
|
10
|
+
@format = 'json'
|
11
|
+
@scheme = 'https'
|
12
|
+
@host = 'api.tpaga.co.local:8443'
|
13
|
+
@base_path = '/api'
|
14
|
+
@user_agent = 'Swagger/Ruby/0.0.2/dev'
|
15
|
+
@inject_format = false
|
16
|
+
@force_ending_format = false
|
17
|
+
@camelize_params = false
|
18
|
+
# for API key/token authentication
|
19
|
+
@api_key = '';
|
20
|
+
@api_key_type = '';
|
21
|
+
@api_key_name = '';
|
22
|
+
@api_key_prefix = '';
|
23
|
+
# for http basic authentication
|
24
|
+
@username = ''
|
25
|
+
@password = ''
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|