conekta 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83ab69573c5690d491101edff2d56b19d677fc66
4
- data.tar.gz: fad10ef60cac5f842d0bfa61e8c8ba092a802cdb
3
+ metadata.gz: 097b1599a6a7156cb2e2338ee84028b1fff0c17e
4
+ data.tar.gz: f991b27518156ec20bd0cfc40a70be611e0dd9cd
5
5
  SHA512:
6
- metadata.gz: 4c9d559f97c949b9b1e60838e59b8b9ba5f0a6912164bcf901e6b15fcf2afeef4b26859d8d075b5cc2241781f55e106af45a0bbfea4b2b2aa03a166a80833a0e
7
- data.tar.gz: eda16417c9f443ddf908931c5a53bd321b024f5d4cca254329137ff56d27e103f1b31112eee5206ad1ef1c9232dc5683f232f36034238826895fd680c8198dc7
6
+ metadata.gz: 0859abffe64be662d6e036fd1d0e9f378f74e673fe7027c78ff2cd8b870b748c2311dec8a0d5bb3735d078d106cbed4a379b2cac92e2b0d08586dcefbd7077b1
7
+ data.tar.gz: ba10a553611871cdcb900c68fedc5e0e25a777d3d1abe5a12bfb47d9fa61c6049a9fd9c7113e14fdab19fc1ca82d54c2e08efbe360d7884d6798e9ed51dc7bcd
data/CHANGELOG CHANGED
@@ -87,4 +87,8 @@
87
87
 
88
88
  == 1.1.1 2017-02-01
89
89
 
90
- * Fix submodels updates.
90
+ * Fix submodels updates.
91
+
92
+ == 1.1.2 2017-02-08
93
+
94
+ * Avoid class name conflicts.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![alt tag](https://raw.github.com/conekta/conekta-ruby/master/readme_files/cover.png)
2
2
 
3
- # Conekta Ruby v.1.1.1
3
+ # Conekta Ruby v.1.1.2
4
4
 
5
5
  This is a ruby library that allows interaction with https://api.conekta.io API.
6
6
 
@@ -19,6 +19,8 @@ require "conekta/util"
19
19
  require "conekta/error"
20
20
  require "conekta/error_list"
21
21
 
22
+ require "conekta/customer_info"
23
+ require "conekta/details"
22
24
  require "conekta/event"
23
25
  require "conekta/charge"
24
26
  require "conekta/customer"
@@ -0,0 +1,5 @@
1
+ module Conekta
2
+ class CustomerInfo < Resource
3
+ attr_accessor :email, :phone, :name, :corporate
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Conekta
2
+ class Details < Resource
3
+ attr_accessor :name, :description, :unit_price, :quantity, :sku, :category
4
+ end
5
+ end
@@ -3,41 +3,46 @@ module Conekta
3
3
 
4
4
  def self.types
5
5
  @types ||= {
6
- 'bank_transfer_payment' => PaymentMethod,
7
- 'bank_transfer_payout_method' => Method,
8
- 'card' => Card,
9
- 'card_payment' => PaymentMethod,
10
- 'cash_payment' => PaymentMethod,
11
- 'charge' => Charge,
12
- 'customer' => Customer,
13
- 'event' => Event,
14
- 'log' => Log,
15
- 'payee' => Payee,
16
- 'payout' => Payout,
17
- 'payout_method' => PayoutMethod,
18
- 'destination' => Destination,
19
- 'plan' => Plan,
20
- 'subscription' => Subscription,
21
- 'token' => Token,
22
- 'webhook' => Webhook,
23
- 'webhook_log' => WebhookLog,
24
- 'refund' => Refund,
25
- 'line_item' => LineItem,
26
- 'address' => Address,
27
- 'order' => Order,
28
- 'payment_source' => PaymentSource,
29
- 'tax_line' => TaxLine,
30
- 'shipping_line' => ShippingLine,
31
- 'discount_line' => DiscountLine,
32
- 'fiscal_entity' => FiscalEntity,
33
- 'shipping_contact' => ShippingContact,
34
- 'list' => List,
35
- 'return' => Return
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
- return resp if name == "data" # event data should not be parsed into objects
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
- instance = constantize(camelize(name)).new
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
@@ -1,3 +1,3 @@
1
1
  module Conekta
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.1.2'.freeze
3
3
  end
@@ -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
- "The object Plan unexistent-plan could not be found."
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.test).to eq(true)
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.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-02 00:00:00.000000000 Z
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