epayco 0.0.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.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.gitignore +13 -0
  5. data/.rspec +2 -0
  6. data/.travis.yml +10 -0
  7. data/.yardopts +6 -0
  8. data/Gemfile +18 -0
  9. data/README.md +258 -0
  10. data/Rakefile +11 -0
  11. data/epayco.gemspec +27 -0
  12. data/lib/epayco.rb +29 -0
  13. data/lib/epayco/api.rb +29 -0
  14. data/lib/epayco/client.rb +15 -0
  15. data/lib/epayco/client/charge.rb +36 -0
  16. data/lib/epayco/client/customer.rb +58 -0
  17. data/lib/epayco/client/plans.rb +115 -0
  18. data/lib/epayco/client/subscription.rb +150 -0
  19. data/lib/epayco/configuration.rb +74 -0
  20. data/lib/epayco/connection.rb +30 -0
  21. data/lib/epayco/error.rb +31 -0
  22. data/lib/epayco/request.rb +44 -0
  23. data/lib/epayco/response.rb +17 -0
  24. data/lib/epayco/version.rb +3 -0
  25. data/lib/faraday/raise_http_exception.rb +59 -0
  26. data/spec/epay_spec.rb +65 -0
  27. data/spec/epayco/client/charge_spec.rb +40 -0
  28. data/spec/epayco/client/customer_spec.rb +43 -0
  29. data/spec/epayco/client/plans_spec.rb +71 -0
  30. data/spec/epayco/client/subscription_spec.rb +68 -0
  31. data/spec/epayco/client_spec.rb +10 -0
  32. data/spec/fixtures/charge_create.json +10 -0
  33. data/spec/fixtures/customer_all.json +22 -0
  34. data/spec/fixtures/customer_create.json +10 -0
  35. data/spec/fixtures/plan_all.json +18 -0
  36. data/spec/fixtures/plan_create.json +9 -0
  37. data/spec/fixtures/plan_details.json +18 -0
  38. data/spec/fixtures/plan_update.json +9 -0
  39. data/spec/fixtures/subscription_all.json +52 -0
  40. data/spec/fixtures/subscription_cancel.json +8 -0
  41. data/spec/fixtures/subscription_create.json +22 -0
  42. data/spec/spec_helper.rb +74 -0
  43. metadata +177 -0
  44. metadata.gz.sig +0 -0
@@ -0,0 +1,10 @@
1
+ {
2
+ "success": true,
3
+ "message": "El cliente ha sido creado con exito para realizar operaciones y enlazarlo use el id: ",
4
+ "data": {
5
+ "status": "Creado",
6
+ "description": "El cliente ha sido creado con exito para realizar operaciones y enlazarlo use el id: 6eba2u73ZBh49Po7q",
7
+ "customerId": "6eba2u73ZBh49Po7q",
8
+ "token": "ZdTo2WFZEH9r3HC7N"
9
+ }
10
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "status": true,
3
+ "object": "plans",
4
+ "plans": [
5
+ {
6
+ "id_plan": "test",
7
+ "object": "plan",
8
+ "name": "Test",
9
+ "description": "Plan de prueba",
10
+ "amount": 30,
11
+ "currency": "usd",
12
+ "interval": "year",
13
+ "status": "active",
14
+ "trialDays": 0,
15
+ "created": "19-02-2017"
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "status": true,
3
+ "message": "El plan ha sido creado exitosamente",
4
+ "data": {
5
+ "status": "Creado",
6
+ "user": "cdc4654c502f9d320ebet4f6230m669d",
7
+ "id": "test"
8
+ }
9
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "status": true,
3
+ "id": "RCmKwTKKqv89rBbHg",
4
+ "object": "plan",
5
+ "created": "2017-02-19T03:13:36.305Z",
6
+ "plan": {
7
+ "id_plan": "test",
8
+ "object": "plan",
9
+ "name": "Test",
10
+ "description": "Plan de prueba",
11
+ "amount": 30,
12
+ "currency": "usd",
13
+ "interval": "year",
14
+ "status": "active",
15
+ "trialDays": 0,
16
+ "created": "19-02-2017"
17
+ }
18
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "status": true,
3
+ "message": "plan actualizado",
4
+ "data": {
5
+ "status": "Actualizado",
6
+ "userId": "5c4773856f296c674685209bbfd11f92",
7
+ "planId": "test"
8
+ }
9
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "success": true,
3
+ "object": "subscriptions",
4
+ "plans": [
5
+ {
6
+ "_id": "wAzyX9Sutm3BaLxM2",
7
+ "idPlan": "cursocarpinteria2",
8
+ "data": {
9
+ "_id": "LS5L9cRaJSWA4ykeM",
10
+ "idClient": "cursocarpinteria2",
11
+ "name": "Curso de carpintería2",
12
+ "description": "En este curso aprenderás carpintería2",
13
+ "amount": 30000,
14
+ "currency": "cop",
15
+ "interval": "month",
16
+ "clientId": "5c4773856f296c674685209bbfd11f92",
17
+ "status": "active",
18
+ "trialDays": 30,
19
+ "createdAt": "2016-09-27T15:29:38.772Z"
20
+ },
21
+ "periodStart": "2016-09-27T15:59:46.339Z",
22
+ "periodEnd": "2016-11-26T15:59:46.339Z",
23
+ "status": "active",
24
+ "idUser": "5c4773856f296c674685209bbfd11f92",
25
+ "idCustomer": "6eba2u73ZBh49Po7q",
26
+ "createdAt": "2016-09-27T15:59:46.352Z"
27
+ },
28
+ {
29
+ "_id": "cZHvGKHxJDd8oY72m",
30
+ "idPlan": "cursocarpinteria2",
31
+ "data": {
32
+ "_id": "LS5L9cRaJSWA4ykeM",
33
+ "idClient": "cursocarpinteria2",
34
+ "name": "Curso de carpintería2",
35
+ "description": "En este curso aprenderás carpintería2",
36
+ "amount": 30000,
37
+ "currency": "cop",
38
+ "interval": "month",
39
+ "clientId": "5c4773856f296c674685209bbfd11f92",
40
+ "status": "active",
41
+ "trialDays": 30,
42
+ "createdAt": "2016-09-27T15:29:38.772Z"
43
+ },
44
+ "periodStart": "2016-09-27T16:49:59.758Z",
45
+ "periodEnd": "2016-11-26T16:49:59.758Z",
46
+ "status": "active",
47
+ "idUser": "5c4773856f296c674685209bbfd11f92",
48
+ "idCustomer": "cus_97dn6u3OFeeeOye",
49
+ "createdAt": "2016-09-27T16:49:59.767Z"
50
+ }
51
+ ]
52
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "success": true,
3
+ "message": "La suscripción ha sido inactivada",
4
+ "data": {
5
+ "status": "Actualizado",
6
+ "description": "La suscripción ha sido inhabilidata para el usuario wAzyX9Sutm3BaLxM2"
7
+ }
8
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "success": true,
3
+ "object": "subscription",
4
+ "id": "wAzyX9Sutm3BaLxM2",
5
+ "created": "Sep 27, 2016 10:59 AM",
6
+ "current_period_start": "Sep 27, 2016 10:59 AM",
7
+ "current_period_end": "Nov 26, 2016 10:59 AM",
8
+ "customer": "6eba2u73ZBh49Po7q",
9
+ "message": "Suscripción creada",
10
+ "data": {
11
+ "id_plan": "cursocarpinteria2",
12
+ "name": "Curso de carpintería2",
13
+ "description": "En este curso aprenderás carpintería2",
14
+ "amount": 30000,
15
+ "currency": "cop",
16
+ "interval": "month",
17
+ "status": "active",
18
+ "trialDays": 30,
19
+ "createdAt": "Sep 27, 2016 10:59 AM"
20
+ },
21
+ "status": "active"
22
+ }
@@ -0,0 +1,74 @@
1
+ begin
2
+ require 'simplecov'
3
+ rescue LoadError
4
+ # ignore
5
+ else
6
+ SimpleCov.start do
7
+ add_group 'EPayCo', 'lib/epayco'
8
+ add_group 'Faraday Middleware', 'lib/faraday'
9
+ add_group 'Specs', 'spec'
10
+ end
11
+ end
12
+
13
+ require File.expand_path('../../lib/epayco', __FILE__)
14
+
15
+ require 'rspec'
16
+ require 'webmock/rspec'
17
+
18
+ RSpec.configure do |config|
19
+ config.include WebMock::API
20
+ # IMPORTANT: DO NOT uncomment this, unless you want to unleash the Darkness.
21
+ # WebMock.allow_net_connect!
22
+ end
23
+
24
+ def capture_output(&block)
25
+ begin
26
+ old_stdout = $stdout
27
+ $stdout = StringIO.new
28
+ block.call
29
+ result = $stdout.string
30
+ ensure
31
+ $stdout = old_stdout
32
+ end
33
+ result
34
+ end
35
+
36
+ def a_delete(path)
37
+ a_request(:delete, EPayCo.endpoint + path)
38
+ end
39
+
40
+ def a_get(path)
41
+ a_request(:get, EPayCo.endpoint + path)
42
+ end
43
+
44
+ def a_post(path)
45
+ a_request(:post, EPayCo.endpoint + path)
46
+ end
47
+
48
+ def a_put(path)
49
+ a_request(:put, EPayCo.endpoint + path)
50
+ end
51
+
52
+ def stub_delete(path)
53
+ stub_request(:delete, EPayCo.endpoint + path)
54
+ end
55
+
56
+ def stub_get(path)
57
+ stub_request(:get, EPayCo.endpoint + path)
58
+ end
59
+
60
+ def stub_post(path)
61
+ stub_request(:post, EPayCo.endpoint + path)
62
+ end
63
+
64
+ def stub_put(path)
65
+ stub_request(:put, EPayCo.endpoint + path)
66
+ end
67
+
68
+ def fixture_path
69
+ File.expand_path("../fixtures", __FILE__)
70
+ end
71
+
72
+ def fixture(file)
73
+ File.new(fixture_path + '/' + file)
74
+ end
metadata ADDED
@@ -0,0 +1,177 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: epayco
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Moises Narvaez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDhTCCAm2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMRYwFAYDVQQDDA1tb2lz
14
+ ZXNuYXJ2YWV6MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
15
+ FgNjb20wHhcNMTcwMjI2MjMzMDQ3WhcNMTgwMjI2MjMzMDQ3WjBEMRYwFAYDVQQD
16
+ DA1tb2lzZXNuYXJ2YWV6MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJ
17
+ k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIkjcm
18
+ 5lyFRNeFla5fydkP8yjGDnEF9e+Y/5dCTDLm62AloayBZUIE0rMshOgHtjioL9en
19
+ 2m5bhlVboHemv21z9gZsRWcGvNDCgwH1PDkpM26PWP5EJbzuQxsDZQ7Xp9xIh2vY
20
+ rcv7iZTzVqG5t7mo62UaLDPwYxeb2s+Ju8+3GMW+d/xBSPRMHDxFkUwtI4POvZpH
21
+ GyjokHtnnWayh45MDz7jPUf7Y43LNu/WqrcGNoeRbDlujlGQFWdQ86RSctkW6cfV
22
+ ePZDxGehKUbx1hAIzuJnhqnikIBudwas9FKmH6tjsdsxIAM4pc+axl7a1zGBV6fU
23
+ yEAiwSGsBqKlXrYRAgMBAAGjgYEwfzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAd
24
+ BgNVHQ4EFgQUUxJr+CBRr2gEC45LJGBqZaGWJ5owIgYDVR0RBBswGYEXbW9pc2Vz
25
+ bmFydmFlekBnbWFpbC5jb20wIgYDVR0SBBswGYEXbW9pc2VzbmFydmFlekBnbWFp
26
+ bC5jb20wDQYJKoZIhvcNAQEFBQADggEBAKbc96Ggj+Sv7jtnJRXnnCDc3PSWF9PE
27
+ CzCpOm6RzOyvc6VJTQU0sHrcjw5GquzmfjhGsI9c7M2jDSF0z6lvr7XeUuSwQ7BQ
28
+ CUPCrpy+3C2fErCXOwCJ7WaCGvDo5cTgEx/mzfB6+N4ymEzYXwx19rlSLatdfX6a
29
+ uVXYJOUAKYALsVlsGzTEySJmN8Q63G2L2T0Y/NhDtHwlC+dabmQfnoFyfBNTCTgR
30
+ bKmithrsrjrik3pTfgthd6HBlv83o/hX8PuX6YMRkphnOlz+pnSirYuC3kGNtLT/
31
+ Kx4MgEy+H9Oi6mctIC1xowFuRuRg5KLKoUpXWPj5uuhw1c+AWfWzmW4=
32
+ -----END CERTIFICATE-----
33
+ date: 2017-02-17 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: faraday
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.11.0
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.11.0
49
+ - !ruby/object:Gem::Dependency
50
+ name: faraday_middleware
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 0.11.0.1
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 0.11.0.1
63
+ - !ruby/object:Gem::Dependency
64
+ name: multi_json
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.12'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.12'
77
+ - !ruby/object:Gem::Dependency
78
+ name: hashie
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3.5'
84
+ type: :runtime
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '3.5'
91
+ description: "%q{The EPayCo Gem provides methods to create, process and manage payment.}"
92
+ email: MoisesNarvaez@gmail.com
93
+ executables: []
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - ".gitignore"
98
+ - ".rspec"
99
+ - ".travis.yml"
100
+ - ".yardopts"
101
+ - Gemfile
102
+ - README.md
103
+ - Rakefile
104
+ - epayco.gemspec
105
+ - lib/epayco.rb
106
+ - lib/epayco/api.rb
107
+ - lib/epayco/client.rb
108
+ - lib/epayco/client/charge.rb
109
+ - lib/epayco/client/customer.rb
110
+ - lib/epayco/client/plans.rb
111
+ - lib/epayco/client/subscription.rb
112
+ - lib/epayco/configuration.rb
113
+ - lib/epayco/connection.rb
114
+ - lib/epayco/error.rb
115
+ - lib/epayco/request.rb
116
+ - lib/epayco/response.rb
117
+ - lib/epayco/version.rb
118
+ - lib/faraday/raise_http_exception.rb
119
+ - spec/epay_spec.rb
120
+ - spec/epayco/client/charge_spec.rb
121
+ - spec/epayco/client/customer_spec.rb
122
+ - spec/epayco/client/plans_spec.rb
123
+ - spec/epayco/client/subscription_spec.rb
124
+ - spec/epayco/client_spec.rb
125
+ - spec/fixtures/charge_create.json
126
+ - spec/fixtures/customer_all.json
127
+ - spec/fixtures/customer_create.json
128
+ - spec/fixtures/plan_all.json
129
+ - spec/fixtures/plan_create.json
130
+ - spec/fixtures/plan_details.json
131
+ - spec/fixtures/plan_update.json
132
+ - spec/fixtures/subscription_all.json
133
+ - spec/fixtures/subscription_cancel.json
134
+ - spec/fixtures/subscription_create.json
135
+ - spec/spec_helper.rb
136
+ homepage: https://github.com/moisesnarvaez/epayco
137
+ licenses:
138
+ - MIT
139
+ metadata: {}
140
+ post_install_message:
141
+ rdoc_options: []
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ requirements: []
155
+ rubyforge_project:
156
+ rubygems_version: 2.5.2
157
+ signing_key:
158
+ specification_version: 4
159
+ summary: "%q{A Gem to interact with epayco.co API}"
160
+ test_files:
161
+ - spec/epay_spec.rb
162
+ - spec/epayco/client/charge_spec.rb
163
+ - spec/epayco/client/customer_spec.rb
164
+ - spec/epayco/client/plans_spec.rb
165
+ - spec/epayco/client/subscription_spec.rb
166
+ - spec/epayco/client_spec.rb
167
+ - spec/fixtures/charge_create.json
168
+ - spec/fixtures/customer_all.json
169
+ - spec/fixtures/customer_create.json
170
+ - spec/fixtures/plan_all.json
171
+ - spec/fixtures/plan_create.json
172
+ - spec/fixtures/plan_details.json
173
+ - spec/fixtures/plan_update.json
174
+ - spec/fixtures/subscription_all.json
175
+ - spec/fixtures/subscription_cancel.json
176
+ - spec/fixtures/subscription_create.json
177
+ - spec/spec_helper.rb
Binary file