cielo-api30 1.0.0 → 1.1.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.
- checksums.yaml +4 -4
- data/lib/cielo/api30.rb +13 -71
- data/lib/cielo/api30/address.rb +37 -36
- data/lib/cielo/api30/client.rb +67 -0
- data/lib/cielo/api30/credit_card.rb +42 -42
- data/lib/cielo/api30/customer.rb +39 -40
- data/lib/cielo/api30/environment.rb +31 -0
- data/lib/cielo/api30/merchant.rb +19 -0
- data/lib/cielo/api30/payment.rb +122 -111
- data/lib/cielo/api30/payment/status.rb +28 -0
- data/lib/cielo/api30/recurrent_payment.rb +35 -36
- data/lib/cielo/api30/request/cielo_error.rb +12 -4
- data/lib/cielo/api30/request/cielo_request.rb +24 -20
- data/lib/cielo/api30/request/create_sale_request.rb +10 -8
- data/lib/cielo/api30/request/query_sale_request.rb +10 -8
- data/lib/cielo/api30/request/update_sale_request.rb +15 -17
- data/lib/cielo/api30/return_info.rb +58 -0
- data/lib/cielo/api30/return_infos.yml +624 -0
- data/lib/cielo/api30/sale.rb +27 -28
- data/lib/cielo/api30/version.rb +4 -4
- metadata +9 -5
- data/lib/cielo/environment.rb +0 -31
- data/lib/cielo/merchant.rb +0 -17
data/lib/cielo/api30/sale.rb
CHANGED
@@ -1,37 +1,36 @@
|
|
1
1
|
module Cielo
|
2
|
+
module API30
|
2
3
|
class Sale
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
attr_accessor :merchant_order_id,
|
5
|
+
:customer,
|
6
|
+
:payment
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
def initialize(merchant_order_id)
|
9
|
+
@merchant_order_id = merchant_order_id
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def to_json(*options)
|
13
|
+
hash = as_json(*options)
|
14
|
+
hash.reject! {|k,v| v.nil?}
|
15
|
+
hash.to_json(*options)
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
sale = Sale.new(data["MerchantOrderId"] || nil)
|
18
|
+
def self.from_json(data)
|
19
|
+
return if data.nil?
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
sale = new(data["MerchantOrderId"])
|
22
|
+
sale.customer = Customer.from_json(data["Customer"])
|
23
|
+
sale.payment = Payment.from_json(data["Payment"])
|
24
|
+
sale
|
25
|
+
end
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
MerchantOrderId: @merchant_order_id,
|
32
|
-
Customer: @customer,
|
33
|
-
Payment: @payment
|
34
|
-
}
|
35
|
-
end
|
27
|
+
def as_json(options={})
|
28
|
+
{
|
29
|
+
MerchantOrderId: @merchant_order_id,
|
30
|
+
Customer: @customer,
|
31
|
+
Payment: @payment
|
32
|
+
}
|
33
|
+
end
|
36
34
|
end
|
35
|
+
end
|
37
36
|
end
|
data/lib/cielo/api30/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cielo-api30
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cielo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,19 +75,23 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- lib/cielo/api30.rb
|
77
77
|
- lib/cielo/api30/address.rb
|
78
|
+
- lib/cielo/api30/client.rb
|
78
79
|
- lib/cielo/api30/credit_card.rb
|
79
80
|
- lib/cielo/api30/customer.rb
|
81
|
+
- lib/cielo/api30/environment.rb
|
82
|
+
- lib/cielo/api30/merchant.rb
|
80
83
|
- lib/cielo/api30/payment.rb
|
84
|
+
- lib/cielo/api30/payment/status.rb
|
81
85
|
- lib/cielo/api30/recurrent_payment.rb
|
82
86
|
- lib/cielo/api30/request/cielo_error.rb
|
83
87
|
- lib/cielo/api30/request/cielo_request.rb
|
84
88
|
- lib/cielo/api30/request/create_sale_request.rb
|
85
89
|
- lib/cielo/api30/request/query_sale_request.rb
|
86
90
|
- lib/cielo/api30/request/update_sale_request.rb
|
91
|
+
- lib/cielo/api30/return_info.rb
|
92
|
+
- lib/cielo/api30/return_infos.yml
|
87
93
|
- lib/cielo/api30/sale.rb
|
88
94
|
- lib/cielo/api30/version.rb
|
89
|
-
- lib/cielo/environment.rb
|
90
|
-
- lib/cielo/merchant.rb
|
91
95
|
homepage: https://github.com/developercielo/API-3.0-Ruby
|
92
96
|
licenses:
|
93
97
|
- MIT
|
@@ -108,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
112
|
version: '0'
|
109
113
|
requirements: []
|
110
114
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.5.
|
115
|
+
rubygems_version: 2.5.2
|
112
116
|
signing_key:
|
113
117
|
specification_version: 4
|
114
118
|
summary: SDK API 3.0 da Cielo
|
data/lib/cielo/environment.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module Cielo
|
2
|
-
# API Environment URLs
|
3
|
-
#
|
4
|
-
# @attr [String] api API URL
|
5
|
-
# @attr [String] apiQuery API Query URL
|
6
|
-
class Environment
|
7
|
-
attr_accessor :api,
|
8
|
-
:api_query
|
9
|
-
|
10
|
-
def initialize(api, api_query)
|
11
|
-
@api = api
|
12
|
-
@api_query = api_query
|
13
|
-
end
|
14
|
-
|
15
|
-
# The production environment
|
16
|
-
#
|
17
|
-
# @return [Environment] a configured Environment for production
|
18
|
-
def self.production()
|
19
|
-
return Environment.new("https://api.cieloecommerce.cielo.com.br/",
|
20
|
-
"https://apiquery.cieloecommerce.cielo.com.br/")
|
21
|
-
end
|
22
|
-
|
23
|
-
# The sandbox environment
|
24
|
-
#
|
25
|
-
# @return [Environment] a configured Environment for testing
|
26
|
-
def self.sandbox()
|
27
|
-
return Environment.new("https://apisandbox.cieloecommerce.cielo.com.br/",
|
28
|
-
"https://apiquerysandbox.cieloecommerce.cielo.com.br/")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/lib/cielo/merchant.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module Cielo
|
2
|
-
# Merchant identification on Cielo
|
3
|
-
#
|
4
|
-
# @attr [String] merchant_id the merchant identification number
|
5
|
-
# @attr [String] merchant_key the merchant identification key
|
6
|
-
class Merchant
|
7
|
-
attr_accessor :merchant_id,
|
8
|
-
:merchant_key
|
9
|
-
|
10
|
-
# @param merchant_id [String] the merchant identification number
|
11
|
-
# @param merchant_key [String] the merchant identification key
|
12
|
-
def initialize(merchant_id, merchant_key)
|
13
|
-
@merchant_id = merchant_id
|
14
|
-
@merchant_key = merchant_key
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|