conekta 0.3.3 → 0.3.5
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 +8 -8
- data/.gitignore +5 -11
- data/CHANGELOG +5 -0
- data/Gemfile +6 -1
- data/LICENSE.txt +22 -0
- data/README.md +59 -0
- data/Rakefile +1 -14
- data/conekta.gemspec +22 -22
- data/lib/conekta.rb +36 -290
- data/lib/conekta/card.rb +10 -34
- data/lib/conekta/charge.rb +14 -38
- data/lib/conekta/conekta_object.rb +64 -136
- data/lib/conekta/customer.rb +23 -25
- data/lib/conekta/error.rb +65 -0
- data/lib/conekta/event.rb +2 -2
- data/lib/conekta/operations/create.rb +19 -0
- data/lib/conekta/operations/create_member.rb +30 -0
- data/lib/conekta/operations/custom_action.rb +17 -0
- data/lib/conekta/operations/delete.rb +43 -0
- data/lib/conekta/operations/find.rb +28 -0
- data/lib/conekta/operations/update.rb +13 -0
- data/lib/conekta/operations/where.rb +28 -0
- data/lib/conekta/payment_method.rb +4 -0
- data/lib/conekta/plan.rb +8 -5
- data/lib/conekta/requestor.rb +55 -0
- data/lib/conekta/resource.rb +13 -0
- data/lib/conekta/subscription.rb +12 -26
- data/lib/conekta/token.rb +3 -2
- data/lib/conekta/util.rb +19 -91
- data/lib/conekta/version.rb +1 -1
- data/lib/ssl_data/ca_bundle.crt +66 -0
- data/spec/conekta_spec.rb +299 -808
- data/spec/spec_helper.rb +12 -0
- metadata +55 -72
- data/CONTRIBUTORS +0 -9
- data/Gemfile.lock +0 -57
- data/History.txt +0 -4
- data/LICENSE +0 -23
- data/README.rdoc +0 -30
- data/VERSION +0 -1
- data/bin/conekta-console +0 -7
- data/bin/test calls +0 -205
- data/gemfiles/default-with-activesupport.gemfile +0 -3
- data/gemfiles/json.gemfile +0 -4
- data/gemfiles/yajl.gemfile +0 -4
- data/lib/conekta/account.rb +0 -4
- data/lib/conekta/api_operations/create.rb +0 -16
- data/lib/conekta/api_operations/create_member.rb +0 -18
- data/lib/conekta/api_operations/delete.rb +0 -11
- data/lib/conekta/api_operations/list.rb +0 -16
- data/lib/conekta/api_operations/modify_member.rb +0 -12
- data/lib/conekta/api_operations/update.rb +0 -22
- data/lib/conekta/api_resource.rb +0 -33
- data/lib/conekta/errors/api_connection_error.rb +0 -4
- data/lib/conekta/errors/api_error.rb +0 -4
- data/lib/conekta/errors/authentication_error.rb +0 -4
- data/lib/conekta/errors/card_error.rb +0 -11
- data/lib/conekta/errors/conekta_error.rb +0 -20
- data/lib/conekta/errors/malformed_request_error.rb +0 -10
- data/lib/conekta/errors/parameter_validation_error.rb +0 -10
- data/lib/conekta/errors/resource_not_found_error.rb +0 -10
- data/lib/conekta/json.rb +0 -21
- data/lib/conekta/list_object.rb +0 -35
- data/lib/conekta/log.rb +0 -5
- data/lib/conekta/singleton_api_resource.rb +0 -20
- data/lib/data/ca-certificates.crt +0 -3918
- data/spec/conekta_with_active_support_spec.rb +0 -3
- data/spec/test_helper.rb +0 -338
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'conekta'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
metadata
CHANGED
@@ -1,72 +1,79 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conekta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Mauricio Murga
|
7
|
+
- MauricioMurga
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-14 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
17
|
- - ~>
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: '1.
|
19
|
+
version: '1.3'
|
21
20
|
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - ~>
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version: '1.
|
26
|
+
version: '1.3'
|
28
27
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
28
|
+
name: rake
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
31
|
- - ! '>='
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
35
|
-
- - <
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '2'
|
33
|
+
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
37
|
requirements:
|
42
38
|
- - ! '>='
|
43
39
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
45
|
-
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
46
53
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
54
|
+
version: '0'
|
48
55
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
56
|
+
name: faraday
|
50
57
|
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
type: :
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
56
63
|
prerelease: false
|
57
64
|
version_requirements: !ruby/object:Gem::Requirement
|
58
65
|
requirements:
|
59
|
-
- -
|
66
|
+
- - ! '>='
|
60
67
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
68
|
+
version: '0'
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
70
|
+
name: json
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
72
|
requirements:
|
66
73
|
- - ! '>='
|
67
74
|
- !ruby/object:Gem::Version
|
68
75
|
version: '0'
|
69
|
-
type: :
|
76
|
+
type: :runtime
|
70
77
|
prerelease: false
|
71
78
|
version_requirements: !ruby/object:Gem::Requirement
|
72
79
|
requirements:
|
@@ -74,85 +81,61 @@ dependencies:
|
|
74
81
|
- !ruby/object:Gem::Version
|
75
82
|
version: '0'
|
76
83
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
84
|
+
name: sys-uname
|
78
85
|
requirement: !ruby/object:Gem::Requirement
|
79
86
|
requirements:
|
80
87
|
- - ! '>='
|
81
88
|
- !ruby/object:Gem::Version
|
82
89
|
version: '0'
|
83
|
-
type: :
|
90
|
+
type: :runtime
|
84
91
|
prerelease: false
|
85
92
|
version_requirements: !ruby/object:Gem::Requirement
|
86
93
|
requirements:
|
87
94
|
- - ! '>='
|
88
95
|
- !ruby/object:Gem::Version
|
89
96
|
version: '0'
|
90
|
-
description:
|
97
|
+
description: Ruby library for https://api.conekta.io
|
91
98
|
email:
|
92
|
-
-
|
93
|
-
|
94
|
-
executables:
|
95
|
-
- conekta-console
|
96
|
-
- test calls
|
99
|
+
- mauricio@conekta.io
|
100
|
+
executables: []
|
97
101
|
extensions: []
|
98
102
|
extra_rdoc_files: []
|
99
103
|
files:
|
100
104
|
- .gitignore
|
101
|
-
-
|
105
|
+
- CHANGELOG
|
102
106
|
- Gemfile
|
103
|
-
-
|
104
|
-
-
|
105
|
-
- LICENSE
|
106
|
-
- README.rdoc
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.md
|
107
109
|
- Rakefile
|
108
|
-
- VERSION
|
109
|
-
- bin/conekta-console
|
110
|
-
- bin/test calls
|
111
110
|
- conekta.gemspec
|
112
|
-
- gemfiles/default-with-activesupport.gemfile
|
113
|
-
- gemfiles/json.gemfile
|
114
|
-
- gemfiles/yajl.gemfile
|
115
111
|
- lib/conekta.rb
|
116
|
-
- lib/conekta/account.rb
|
117
|
-
- lib/conekta/api_operations/create.rb
|
118
|
-
- lib/conekta/api_operations/create.rb~
|
119
|
-
- lib/conekta/api_operations/create_member.rb
|
120
|
-
- lib/conekta/api_operations/create_member.rb~
|
121
|
-
- lib/conekta/api_operations/delete.rb
|
122
|
-
- lib/conekta/api_operations/list.rb
|
123
|
-
- lib/conekta/api_operations/modify_member.rb
|
124
|
-
- lib/conekta/api_operations/modify_member.rb~
|
125
|
-
- lib/conekta/api_operations/update.rb
|
126
|
-
- lib/conekta/api_operations/update.rb~
|
127
|
-
- lib/conekta/api_resource.rb
|
128
112
|
- lib/conekta/card.rb
|
129
113
|
- lib/conekta/charge.rb
|
130
114
|
- lib/conekta/conekta_object.rb
|
131
115
|
- lib/conekta/customer.rb
|
132
|
-
- lib/conekta/
|
133
|
-
- lib/conekta/errors/api_error.rb
|
134
|
-
- lib/conekta/errors/authentication_error.rb
|
135
|
-
- lib/conekta/errors/card_error.rb
|
136
|
-
- lib/conekta/errors/conekta_error.rb
|
137
|
-
- lib/conekta/errors/malformed_request_error.rb
|
138
|
-
- lib/conekta/errors/parameter_validation_error.rb
|
139
|
-
- lib/conekta/errors/resource_not_found_error.rb
|
116
|
+
- lib/conekta/error.rb
|
140
117
|
- lib/conekta/event.rb
|
141
|
-
- lib/conekta/
|
142
|
-
- lib/conekta/
|
143
|
-
- lib/conekta/
|
118
|
+
- lib/conekta/operations/create.rb
|
119
|
+
- lib/conekta/operations/create_member.rb
|
120
|
+
- lib/conekta/operations/custom_action.rb
|
121
|
+
- lib/conekta/operations/delete.rb
|
122
|
+
- lib/conekta/operations/find.rb
|
123
|
+
- lib/conekta/operations/update.rb
|
124
|
+
- lib/conekta/operations/where.rb
|
125
|
+
- lib/conekta/payment_method.rb
|
144
126
|
- lib/conekta/plan.rb
|
145
|
-
- lib/conekta/
|
127
|
+
- lib/conekta/requestor.rb
|
128
|
+
- lib/conekta/resource.rb
|
146
129
|
- lib/conekta/subscription.rb
|
147
130
|
- lib/conekta/token.rb
|
148
131
|
- lib/conekta/util.rb
|
149
132
|
- lib/conekta/version.rb
|
150
|
-
- lib/
|
133
|
+
- lib/ssl_data/ca_bundle.crt
|
151
134
|
- spec/conekta_spec.rb
|
152
|
-
- spec/
|
153
|
-
|
154
|
-
|
155
|
-
|
135
|
+
- spec/spec_helper.rb
|
136
|
+
homepage: https://www.conekta.io
|
137
|
+
licenses:
|
138
|
+
- MIT
|
156
139
|
metadata: {}
|
157
140
|
post_install_message:
|
158
141
|
rdoc_options: []
|
@@ -173,6 +156,6 @@ rubyforge_project:
|
|
173
156
|
rubygems_version: 2.1.11
|
174
157
|
signing_key:
|
175
158
|
specification_version: 4
|
176
|
-
summary:
|
159
|
+
summary: This library provides https://api.conekta.io operations
|
177
160
|
test_files: []
|
178
161
|
has_rdoc:
|
data/CONTRIBUTORS
DELETED
data/Gemfile.lock
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
conekta (0.3.2)
|
5
|
-
multi_json (>= 1.0.4, < 2)
|
6
|
-
rest-client (~> 1.4)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
activesupport (4.0.0)
|
12
|
-
i18n (~> 0.6, >= 0.6.4)
|
13
|
-
minitest (~> 4.2)
|
14
|
-
multi_json (~> 1.3)
|
15
|
-
thread_safe (~> 0.1)
|
16
|
-
tzinfo (~> 0.3.37)
|
17
|
-
atomic (1.1.10)
|
18
|
-
bourne (1.5.0)
|
19
|
-
mocha (>= 0.13.2, < 0.15)
|
20
|
-
diff-lcs (1.2.4)
|
21
|
-
i18n (0.6.4)
|
22
|
-
metaclass (0.0.1)
|
23
|
-
mime-types (2.0)
|
24
|
-
minitest (4.7.5)
|
25
|
-
mocha (0.13.3)
|
26
|
-
metaclass (~> 0.0.1)
|
27
|
-
multi_json (1.7.7)
|
28
|
-
rake (10.1.0)
|
29
|
-
rest-client (1.6.7)
|
30
|
-
mime-types (>= 1.16)
|
31
|
-
rspec (2.14.1)
|
32
|
-
rspec-core (~> 2.14.0)
|
33
|
-
rspec-expectations (~> 2.14.0)
|
34
|
-
rspec-mocks (~> 2.14.0)
|
35
|
-
rspec-core (2.14.2)
|
36
|
-
rspec-expectations (2.14.0)
|
37
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
38
|
-
rspec-mocks (2.14.1)
|
39
|
-
shoulda (3.4.0)
|
40
|
-
shoulda-context (~> 1.0, >= 1.0.1)
|
41
|
-
shoulda-matchers (~> 1.0, >= 1.4.1)
|
42
|
-
shoulda-context (1.1.4)
|
43
|
-
shoulda-matchers (1.5.6)
|
44
|
-
activesupport (>= 3.0.0)
|
45
|
-
bourne (~> 1.3)
|
46
|
-
thread_safe (0.1.1)
|
47
|
-
atomic
|
48
|
-
tzinfo (0.3.37)
|
49
|
-
|
50
|
-
PLATFORMS
|
51
|
-
ruby
|
52
|
-
|
53
|
-
DEPENDENCIES
|
54
|
-
conekta!
|
55
|
-
rake
|
56
|
-
rspec
|
57
|
-
shoulda (~> 3.4.0)
|
data/History.txt
DELETED
data/LICENSE
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
The MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2013- Conekta (http://conekta.mx)
|
4
|
-
|
5
|
-
Copyright (c) 2011-2013 Stripe, Inc. (https://stripe.com)
|
6
|
-
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
-
of this software and associated documentation files (the "Software"), to deal
|
9
|
-
in the Software without restriction, including without limitation the rights
|
10
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
-
copies of the Software, and to permit persons to whom the Software is
|
12
|
-
furnished to do so, subject to the following conditions:
|
13
|
-
|
14
|
-
The above copyright notice and this permission notice shall be included in
|
15
|
-
all copies or substantial portions of the Software.
|
16
|
-
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
-
THE SOFTWARE.
|
data/README.rdoc
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
= Conekta Ruby bindings
|
2
|
-
|
3
|
-
== Update
|
4
|
-
|
5
|
-
Update to latest version 0.3.2. Earlier versions are deprecated!
|
6
|
-
|
7
|
-
== Installation
|
8
|
-
|
9
|
-
You don't need this source code unless you want to modify the gem. If
|
10
|
-
you want to install the gem via bundler you should add this line to your gemfile:
|
11
|
-
|
12
|
-
gem "conekta", "~> 0.3.2"
|
13
|
-
|
14
|
-
You can also install this gem by running:
|
15
|
-
|
16
|
-
gem install conekta
|
17
|
-
|
18
|
-
If you want to build the gem from source:
|
19
|
-
|
20
|
-
gem build conekta.gemspec
|
21
|
-
|
22
|
-
== Requirements
|
23
|
-
|
24
|
-
* Ruby 1.8.7 or above. (Ruby 1.8.6 may work if you load
|
25
|
-
ActiveSupport.)
|
26
|
-
* rest-client, multi_json
|
27
|
-
|
28
|
-
== Development
|
29
|
-
|
30
|
-
Test cases can be run with: `bundle exec rake spec`
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.3
|
data/bin/conekta-console
DELETED
data/bin/test calls
DELETED
@@ -1,205 +0,0 @@
|
|
1
|
-
Conekta.api_key="1tv5yJp3xnVZ7eK67m4h"
|
2
|
-
charge = Conekta::Charge.create({
|
3
|
-
"description"=>"Stogies",
|
4
|
-
"amount"=> 20000,
|
5
|
-
"currency"=>"MXN",
|
6
|
-
"reference_id"=>"9839-wolf_pack",
|
7
|
-
"card"=> "tok_test_visa_4242"
|
8
|
-
})
|
9
|
-
#<Conekta::Charge:0x4b8a584> JSON: {
|
10
|
-
"id": "529f5c51cfc26cd15f000001",
|
11
|
-
"livemode": false,
|
12
|
-
"created_at": 1386175569,
|
13
|
-
"status": "pending_payment",
|
14
|
-
"currency": "MXN",
|
15
|
-
"description": "Stogies",
|
16
|
-
"reference_id": "9839-wolf_pack",
|
17
|
-
"failure_code": null,
|
18
|
-
"failure_message": null,
|
19
|
-
"object": "charge",
|
20
|
-
"amount": 20000,
|
21
|
-
"fee": 998,
|
22
|
-
"payment_method": {"name":"Fulanito Lopez","exp_month":"12","exp_year":"19","auth_code":null,"object":"card_payment","last4":"4242","brand":"visa"},
|
23
|
-
"details": {"name":null,"phone":null,"email":null,"line_items":[]}
|
24
|
-
}
|
25
|
-
customer = Conekta::Customer.create({"cards"=> ["tok_test_visa_4242"]})
|
26
|
-
#<Conekta::Customer:0x4e2cf3a> JSON: {
|
27
|
-
"id": "cus_mvWeMJftBGnhuPzPQ",
|
28
|
-
"email": null,
|
29
|
-
"name": null,
|
30
|
-
"phone": null,
|
31
|
-
"livemode": false,
|
32
|
-
"default_card_id": "card_uHAemUaNvM2pa5Tf",
|
33
|
-
"object": "customer",
|
34
|
-
"created_at": 1386175612,
|
35
|
-
"cards": [
|
36
|
-
{"id":"card_uHAemUaNvM2pa5Tf","created_at":1386175612,"active":true,"last4":"4242","object":"card","exp_month":"12","exp_year":"19","brand":"VISA","name":"Fulanito Lopez"}
|
37
|
-
],
|
38
|
-
"subscription": null
|
39
|
-
}
|
40
|
-
customer.cards[0].delete
|
41
|
-
#<Conekta::Card:0x4e2c724> JSON: {
|
42
|
-
"id": "card_uHAemUaNvM2pa5Tf",
|
43
|
-
"created_at": 1386175612,
|
44
|
-
"active": true,
|
45
|
-
"last4": "4242",
|
46
|
-
"object": "card",
|
47
|
-
"exp_month": "12",
|
48
|
-
"exp_year": "19",
|
49
|
-
"brand": "VISA",
|
50
|
-
"name": "Fulanito Lopez",
|
51
|
-
"deleted": true
|
52
|
-
}
|
53
|
-
customer.cards
|
54
|
-
[]
|
55
|
-
customer.create_card({"token"=> "tok_test_visa_4242"})
|
56
|
-
#<Conekta::Card:0x4ed7b1a> JSON: {
|
57
|
-
"id": "card_sQJ67YasvBqywCez",
|
58
|
-
"created_at": 1386175697,
|
59
|
-
"active": true,
|
60
|
-
"last4": "4242",
|
61
|
-
"object": "card",
|
62
|
-
"exp_month": "12",
|
63
|
-
"exp_year": "19",
|
64
|
-
"brand": "VISA",
|
65
|
-
"name": "Fulanito Lopez"
|
66
|
-
}
|
67
|
-
customer.cards[0].update(:token => "tok_test_visa_1881")
|
68
|
-
#<Conekta::Card:0x4ed7b1a> JSON: {
|
69
|
-
"id": "card_sQJ67YasvBqywCez",
|
70
|
-
"created_at": 1386175697,
|
71
|
-
"active": true,
|
72
|
-
"last4": "1881",
|
73
|
-
"object": "card",
|
74
|
-
"exp_month": "12",
|
75
|
-
"exp_year": "19",
|
76
|
-
"brand": "VISA",
|
77
|
-
"name": "Fulanito Lopez"
|
78
|
-
}
|
79
|
-
customer.cards
|
80
|
-
[#<Conekta::Card:0x4ed7b1a> JSON: {
|
81
|
-
"id": "card_sQJ67YasvBqywCez",
|
82
|
-
"created_at": 1386175697,
|
83
|
-
"active": true,
|
84
|
-
"last4": "1881",
|
85
|
-
"object": "card",
|
86
|
-
"exp_month": "12",
|
87
|
-
"exp_year": "19",
|
88
|
-
"brand": "VISA",
|
89
|
-
"name": "Fulanito Lopez"
|
90
|
-
}]
|
91
|
-
plan = Conekta::Plan.retrieve("gold-plan")
|
92
|
-
#<Conekta::Plan:0x4ee1c00> JSON: {
|
93
|
-
"id": "gold-plan",
|
94
|
-
"livemode": false,
|
95
|
-
"created_at": 1385481591,
|
96
|
-
"name": "Gold Plan",
|
97
|
-
"amount": 10000,
|
98
|
-
"currency": "MXN",
|
99
|
-
"interval": "week",
|
100
|
-
"frequency": 1,
|
101
|
-
"expiry_count": null,
|
102
|
-
"trial_period_days": null,
|
103
|
-
"object": "plan"
|
104
|
-
}
|
105
|
-
plan.update({
|
106
|
-
:id => "gold-plan",
|
107
|
-
:name => "Gold Plan",
|
108
|
-
:amount => 20000,
|
109
|
-
:currency => "MXN",
|
110
|
-
:interval => "month",
|
111
|
-
:frequency => 1,
|
112
|
-
:trial_period_days => 15,
|
113
|
-
:expiry_count => 12})
|
114
|
-
#<Conekta::Plan:0x4ee1c00> JSON: {
|
115
|
-
"id": "gold-plan",
|
116
|
-
"livemode": false,
|
117
|
-
"created_at": 1385481591,
|
118
|
-
"name": "Gold Plan",
|
119
|
-
"amount": 20000,
|
120
|
-
"currency": "MXN",
|
121
|
-
"interval": "month",
|
122
|
-
"frequency": 1,
|
123
|
-
"expiry_count": 12,
|
124
|
-
"trial_period_days": 15,
|
125
|
-
"object": "plan"
|
126
|
-
}
|
127
|
-
plan
|
128
|
-
=> #<Conekta::Plan:0x4ee1c00> JSON: {
|
129
|
-
"id": "gold-plan",
|
130
|
-
"livemode": false,
|
131
|
-
"created_at": 1385481591,
|
132
|
-
"name": "Gold Plan",
|
133
|
-
"amount": 20000,
|
134
|
-
"currency": "MXN",
|
135
|
-
"interval": "month",
|
136
|
-
"frequency": 1,
|
137
|
-
"expiry_count": 12,
|
138
|
-
"trial_period_days": 15,
|
139
|
-
"object": "plan"
|
140
|
-
}
|
141
|
-
subscription = customer.create_subscription({:plan => "gold-plan"})
|
142
|
-
#<Conekta::Subscription:0x4da1ea8> JSON: {
|
143
|
-
"id": "sub_GxJJGD5V2fez2sjKP",
|
144
|
-
"status": "in_trial",
|
145
|
-
"object": "subscription",
|
146
|
-
"created_at": 1386175781,
|
147
|
-
"start": 1386175781,
|
148
|
-
"billing_cycle_start": 1386175781,
|
149
|
-
"billing_cycle_end": 1388767781,
|
150
|
-
"plan_id": "gold-plan",
|
151
|
-
"card_id": "card_sQJ67YasvBqywCez"
|
152
|
-
}
|
153
|
-
subscription.cancel
|
154
|
-
#<Conekta::Subscription:0x4da1ea8> JSON: {
|
155
|
-
"id": "sub_GxJJGD5V2fez2sjKP",
|
156
|
-
"status": "canceled",
|
157
|
-
"object": "subscription",
|
158
|
-
"created_at": 1386175781,
|
159
|
-
"start": 1386175781,
|
160
|
-
"billing_cycle_start": 1386175781,
|
161
|
-
"billing_cycle_end": 1388767781,
|
162
|
-
"plan_id": "gold-plan",
|
163
|
-
"card_id": "card_sQJ67YasvBqywCez",
|
164
|
-
"canceled_at": 1386175791
|
165
|
-
}
|
166
|
-
subscription
|
167
|
-
#<Conekta::Subscription:0x4da1ea8> JSON: {
|
168
|
-
"id": "sub_GxJJGD5V2fez2sjKP",
|
169
|
-
"status": "canceled",
|
170
|
-
"object": "subscription",
|
171
|
-
"created_at": 1386175781,
|
172
|
-
"start": 1386175781,
|
173
|
-
"billing_cycle_start": 1386175781,
|
174
|
-
"billing_cycle_end": 1388767781,
|
175
|
-
"plan_id": "gold-plan",
|
176
|
-
"card_id": "card_sQJ67YasvBqywCez",
|
177
|
-
"canceled_at": 1386175791
|
178
|
-
}
|
179
|
-
subscription.pause
|
180
|
-
#<Conekta::Subscription:0x4da1ea8> JSON: {
|
181
|
-
"id": "sub_GxJJGD5V2fez2sjKP",
|
182
|
-
"status": "paused",
|
183
|
-
"object": "subscription",
|
184
|
-
"created_at": 1386175781,
|
185
|
-
"start": 1386175781,
|
186
|
-
"billing_cycle_start": 1386175781,
|
187
|
-
"plan_id": "gold-plan",
|
188
|
-
"card_id": "card_sQJ67YasvBqywCez",
|
189
|
-
"canceled_at": 1386175791,
|
190
|
-
"paused_at": 1386175833
|
191
|
-
}
|
192
|
-
subscription.resume
|
193
|
-
#<Conekta::Subscription:0x4da1ea8> JSON: {
|
194
|
-
"id": "sub_GxJJGD5V2fez2sjKP",
|
195
|
-
"status": "active",
|
196
|
-
"object": "subscription",
|
197
|
-
"created_at": 1386175781,
|
198
|
-
"start": 1386175781,
|
199
|
-
"billing_cycle_start": 1386175781,
|
200
|
-
"plan_id": "gold-plan",
|
201
|
-
"card_id": "card_sQJ67YasvBqywCez",
|
202
|
-
"canceled_at": 1386175791,
|
203
|
-
"billing_cycle_end": 1388767798
|
204
|
-
}
|
205
|
-
|