conekta 1.1.1 → 1.1.2
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/CHANGELOG +5 -1
- data/README.md +1 -1
- data/lib/conekta.rb +2 -0
- data/lib/conekta/customer_info.rb +5 -0
- data/lib/conekta/details.rb +5 -0
- data/lib/conekta/util.rb +42 -33
- data/lib/conekta/version.rb +1 -1
- data/spec/conekta/1.0.0/customer_spec.rb +1 -1
- data/spec/conekta/2.0.0/order_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 097b1599a6a7156cb2e2338ee84028b1fff0c17e
|
4
|
+
data.tar.gz: f991b27518156ec20bd0cfc40a70be611e0dd9cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0859abffe64be662d6e036fd1d0e9f378f74e673fe7027c78ff2cd8b870b748c2311dec8a0d5bb3735d078d106cbed4a379b2cac92e2b0d08586dcefbd7077b1
|
7
|
+
data.tar.gz: ba10a553611871cdcb900c68fedc5e0e25a777d3d1abe5a12bfb47d9fa61c6049a9fd9c7113e14fdab19fc1ca82d54c2e08efbe360d7884d6798e9ed51dc7bcd
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
data/lib/conekta.rb
CHANGED
data/lib/conekta/util.rb
CHANGED
@@ -3,41 +3,46 @@ module Conekta
|
|
3
3
|
|
4
4
|
def self.types
|
5
5
|
@types ||= {
|
6
|
-
'
|
7
|
-
'
|
8
|
-
'
|
9
|
-
'
|
10
|
-
'
|
11
|
-
'
|
12
|
-
'
|
13
|
-
'
|
14
|
-
'
|
15
|
-
'
|
16
|
-
'
|
17
|
-
'
|
18
|
-
'
|
19
|
-
'
|
20
|
-
'
|
21
|
-
'
|
22
|
-
'
|
23
|
-
'
|
24
|
-
'
|
25
|
-
'
|
26
|
-
'
|
27
|
-
'
|
28
|
-
'
|
29
|
-
'
|
30
|
-
'
|
31
|
-
'
|
32
|
-
'
|
33
|
-
'
|
34
|
-
'
|
35
|
-
'
|
6
|
+
'customer_info' => ::Conekta::CustomerInfo,
|
7
|
+
'details' => ::Conekta::Details,
|
8
|
+
'bank_transfer_payment' => ::Conekta::PaymentMethod,
|
9
|
+
'bank_transfer_payout_method' => ::Conekta::Method,
|
10
|
+
'card' => ::Conekta::Card,
|
11
|
+
'card_payment' => ::Conekta::PaymentMethod,
|
12
|
+
'cash_payment' => ::Conekta::PaymentMethod,
|
13
|
+
'charge' => ::Conekta::Charge,
|
14
|
+
'customer' => ::Conekta::Customer,
|
15
|
+
'event' => ::Conekta::Event,
|
16
|
+
'log' => ::Conekta::Log,
|
17
|
+
'payee' => ::Conekta::Payee,
|
18
|
+
'payout' => ::Conekta::Payout,
|
19
|
+
'payout_method' => ::Conekta::PayoutMethod,
|
20
|
+
'destination' => ::Conekta::Destination,
|
21
|
+
'plan' => ::Conekta::Plan,
|
22
|
+
'subscription' => ::Conekta::Subscription,
|
23
|
+
'token' => ::Conekta::Token,
|
24
|
+
'webhook' => ::Conekta::Webhook,
|
25
|
+
'webhook_log' => ::Conekta::WebhookLog,
|
26
|
+
'refund' => ::Conekta::Refund,
|
27
|
+
'line_item' => ::Conekta::LineItem,
|
28
|
+
'address' => ::Conekta::Address,
|
29
|
+
'billing_address' => ::Conekta::Address,
|
30
|
+
'shipping_address' => ::Conekta::Address,
|
31
|
+
'order' => ::Conekta::Order,
|
32
|
+
'payment_source' => ::Conekta::PaymentSource,
|
33
|
+
'tax_line' => ::Conekta::TaxLine,
|
34
|
+
'shipping_line' => ::Conekta::ShippingLine,
|
35
|
+
'discount_line' => ::Conekta::DiscountLine,
|
36
|
+
'fiscal_entity' => ::Conekta::FiscalEntity,
|
37
|
+
'shipping_contact' => ::Conekta::ShippingContact,
|
38
|
+
'list' => ::Conekta::List,
|
39
|
+
'return' => ::Conekta::Return
|
36
40
|
}
|
37
41
|
end
|
38
42
|
|
39
43
|
def self.convert_to_conekta_object(name,resp)
|
40
|
-
|
44
|
+
# these json strings should not be parsed into objects
|
45
|
+
return resp if ["data", "request_body", "request_headers", "response_headers", "response_body", "query_string", "metadata", "vertical_info"].include?(name)
|
41
46
|
if resp.kind_of?(Hash)
|
42
47
|
if resp.has_key?('object') and types[resp['object']]
|
43
48
|
if resp['object'] == "list"
|
@@ -56,7 +61,11 @@ module Conekta
|
|
56
61
|
if !Object.const_defined?(camelize(name))
|
57
62
|
instance = Object.const_set(camelize(name), Class.new(ConektaObject)).new
|
58
63
|
else
|
59
|
-
|
64
|
+
begin
|
65
|
+
instance = constantize("Conekta::"+camelize(name)).new
|
66
|
+
rescue # Class is not defined
|
67
|
+
instance = constantize(camelize(name)).new
|
68
|
+
end
|
60
69
|
end
|
61
70
|
|
62
71
|
instance.load_from(resp)
|
@@ -125,4 +134,4 @@ module Conekta
|
|
125
134
|
end
|
126
135
|
end
|
127
136
|
end
|
128
|
-
end
|
137
|
+
end
|
data/lib/conekta/version.rb
CHANGED
@@ -89,7 +89,7 @@ describe Conekta::Customer do
|
|
89
89
|
expect { customer.create_subscription({plan: 'unexistent-plan'}) }.to \
|
90
90
|
raise_error(
|
91
91
|
Conekta::ResourceNotFoundError,
|
92
|
-
|
92
|
+
'The object Plan "unexistent-plan" could not be found.'
|
93
93
|
)
|
94
94
|
end
|
95
95
|
end
|
@@ -88,7 +88,7 @@ describe Conekta::Order do
|
|
88
88
|
order = Conekta::Order.create(order_data)
|
89
89
|
|
90
90
|
expect(order).to be_a(Conekta::Order)
|
91
|
-
expect(order.metadata
|
91
|
+
expect(order.metadata["test"]).to eq(true)
|
92
92
|
end
|
93
93
|
|
94
94
|
it "successful order with fiscal_entity create" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conekta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MauricioMurga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,7 +130,9 @@ files:
|
|
130
130
|
- lib/conekta/charge.rb
|
131
131
|
- lib/conekta/conekta_object.rb
|
132
132
|
- lib/conekta/customer.rb
|
133
|
+
- lib/conekta/customer_info.rb
|
133
134
|
- lib/conekta/destination.rb
|
135
|
+
- lib/conekta/details.rb
|
134
136
|
- lib/conekta/discount_line.rb
|
135
137
|
- lib/conekta/error.rb
|
136
138
|
- lib/conekta/error_list.rb
|