espago 0.0.9 → 0.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.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -0
  3. data/Gemfile.lock +14 -1
  4. data/Guardfile +1 -0
  5. data/README.md +118 -6
  6. data/espago.gemspec +6 -1
  7. data/lib/espago.rb +4 -3
  8. data/lib/espago/api_connection.rb +16 -7
  9. data/lib/espago/api_connection/{post_clients.rb → api.rb} +1 -5
  10. data/lib/espago/api_connection/api_delete.rb +9 -0
  11. data/lib/espago/api_connection/api_get.rb +13 -0
  12. data/lib/espago/api_connection/api_post.rb +9 -0
  13. data/lib/espago/api_connection/api_put.rb +9 -0
  14. data/lib/espago/api_connection/charges_complete_post.rb +9 -0
  15. data/lib/espago/api_connection/charges_delete.rb +9 -0
  16. data/lib/espago/api_connection/charges_get.rb +9 -0
  17. data/lib/espago/api_connection/charges_post.rb +9 -0
  18. data/lib/espago/api_connection/{post_charges_refund.rb → charges_refund_post.rb} +1 -5
  19. data/lib/espago/api_connection/clients_authorize_post.rb +9 -0
  20. data/lib/espago/api_connection/clients_delete.rb +9 -0
  21. data/lib/espago/api_connection/clients_get.rb +9 -0
  22. data/lib/espago/api_connection/clients_invoices_get.rb +9 -0
  23. data/lib/espago/api_connection/clients_post.rb +9 -0
  24. data/lib/espago/api_connection/clients_put.rb +9 -0
  25. data/lib/espago/api_connection/clients_subscriptions_get.rb +9 -0
  26. data/lib/espago/api_connection/complete_post.rb +14 -0
  27. data/lib/espago/api_connection/invoice_items_delete.rb +9 -0
  28. data/lib/espago/api_connection/invoice_items_get.rb +9 -0
  29. data/lib/espago/api_connection/invoice_items_post.rb +9 -0
  30. data/lib/espago/api_connection/invoices_get.rb +9 -0
  31. data/lib/espago/api_connection/line_items_get.rb +9 -0
  32. data/lib/espago/api_connection/plans_delete.rb +9 -0
  33. data/lib/espago/api_connection/plans_get.rb +9 -0
  34. data/lib/espago/api_connection/plans_post.rb +9 -0
  35. data/lib/espago/api_connection/plans_put.rb +9 -0
  36. data/lib/espago/api_connection/subscriptions_delete.rb +9 -0
  37. data/lib/espago/api_connection/subscriptions_get.rb +9 -0
  38. data/lib/espago/api_connection/subscriptions_post.rb +9 -0
  39. data/lib/espago/api_connection/tokens_get.rb +9 -0
  40. data/lib/espago/api_connection/{post_tokens.rb → tokens_post.rb} +2 -2
  41. data/lib/espago/back_request.rb +33 -0
  42. data/lib/espago/client.rb +12 -3
  43. data/lib/espago/router.rb +1 -1
  44. data/lib/espago/version.rb +1 -1
  45. data/spec/espago/api_connection_spec.rb +4 -3
  46. data/spec/espago/back_request_spec.rb +33 -0
  47. data/spec/espago/client_spec.rb +3 -2
  48. data/spec/espago/router_spec.rb +2 -2
  49. data/spec/features/apis_spec.rb +21 -0
  50. data/spec/features/charges_spec.rb +79 -0
  51. data/spec/features/clients_spec.rb +100 -0
  52. data/spec/features/error_spec.rb +28 -0
  53. data/spec/features/invoice_items_spec.rb +37 -0
  54. data/spec/features/invoices_spec.rb +24 -0
  55. data/spec/features/line_items_spec.rb +17 -0
  56. data/spec/features/plans_spec.rb +61 -0
  57. data/spec/features/subscriptions_spec.rb +43 -0
  58. data/spec/features/tokens_spec.rb +40 -0
  59. data/spec/fixtures/cassettes/api_2.yml +68 -0
  60. data/spec/fixtures/cassettes/api_3.yml +68 -0
  61. data/spec/fixtures/cassettes/charges_complete.yml +48 -0
  62. data/spec/fixtures/cassettes/charges_complete_deprecation.yml +48 -0
  63. data/spec/fixtures/cassettes/charges_destroy.yml +46 -0
  64. data/spec/fixtures/cassettes/charges_get.yml +67 -0
  65. data/spec/fixtures/cassettes/charges_get_pay_mTOngouLTJWZ0w.yml +46 -0
  66. data/spec/fixtures/cassettes/charges_post.yml +48 -0
  67. data/spec/fixtures/cassettes/charges_refund.yml +48 -0
  68. data/spec/fixtures/cassettes/clients_authorize.yml +48 -0
  69. data/spec/fixtures/cassettes/clients_delete.yml +42 -0
  70. data/spec/fixtures/cassettes/clients_get.yml +46 -0
  71. data/spec/fixtures/cassettes/clients_get_cli_w0Se2smYwyQ0Uw.yml +46 -0
  72. data/spec/fixtures/cassettes/clients_invoices.yml +46 -0
  73. data/spec/fixtures/cassettes/clients_post.yml +48 -0
  74. data/spec/fixtures/cassettes/clients_put.yml +48 -0
  75. data/spec/fixtures/cassettes/clients_subscriptions.yml +46 -0
  76. data/spec/fixtures/cassettes/error_400.yml +46 -0
  77. data/spec/fixtures/cassettes/error_401.yml +46 -0
  78. data/spec/fixtures/cassettes/error_500.yml +46 -0
  79. data/spec/fixtures/cassettes/invoice_items_delete_ii_WDzszvhTshe78Xd.yml +42 -0
  80. data/spec/fixtures/cassettes/invoice_items_get_ii_5LS-YR7S1QaJBl3.yml +47 -0
  81. data/spec/fixtures/cassettes/invoice_items_post_ii_5LS-YR7S1QaJBl3.yml +49 -0
  82. data/spec/fixtures/cassettes/invoices_get.yml +46 -0
  83. data/spec/fixtures/cassettes/invoices_get_in_tUCMhwlg2nkvAaL.yml +46 -0
  84. data/spec/fixtures/cassettes/line_items_get.yml +47 -0
  85. data/spec/fixtures/cassettes/plans_delete.yml +42 -0
  86. data/spec/fixtures/cassettes/plans_get.yml +46 -0
  87. data/spec/fixtures/cassettes/plans_get_pl_12345.yml +46 -0
  88. data/spec/fixtures/cassettes/plans_post.yml +48 -0
  89. data/spec/fixtures/cassettes/plans_put.yml +44 -0
  90. data/spec/fixtures/cassettes/subscriptions_delete_sub_8yYuCBKdywr7e2.yml +42 -0
  91. data/spec/fixtures/cassettes/subscriptions_get.yml +46 -0
  92. data/spec/fixtures/cassettes/subscriptions_get_sub_8yYuCBKdywr7e2.yml +46 -0
  93. data/spec/fixtures/cassettes/subscriptions_post.yml +48 -0
  94. data/spec/fixtures/cassettes/tokens_get.yml +46 -0
  95. data/spec/fixtures/cassettes/tokens_post.yml +54 -0
  96. data/spec/spec_helper.rb +30 -0
  97. metadata +197 -37
  98. data/lib/espago/api_connection/delete_charges.rb +0 -13
  99. data/lib/espago/api_connection/delete_clients.rb +0 -13
  100. data/lib/espago/api_connection/get_charges.rb +0 -17
  101. data/lib/espago/api_connection/get_clients.rb +0 -17
  102. data/lib/espago/api_connection/get_tokens.rb +0 -13
  103. data/lib/espago/api_connection/post_charges.rb +0 -13
  104. data/lib/espago/api_connection/post_clients_authorize.rb +0 -13
  105. data/lib/espago/api_connection/post_complete.rb +0 -13
  106. data/lib/espago/api_connection/put_clients.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f06d19baed38844060f767678cc1e08df0b64ba
4
- data.tar.gz: 40a3d3d5c42aa5751425aaf3f6ac47428f2b5168
3
+ metadata.gz: 27e99a50c2ebe74762fb3cfbb1d808dfc465fdb9
4
+ data.tar.gz: dfeead9293c23e0c4f4d3a7ccc682d21ef327cb1
5
5
  SHA512:
6
- metadata.gz: 76c47df71036ce428b04abf38ab7dad46122b4d92cc833dfc7280634845dc3ae6e4f3d6b053b95cf4d6f648bd4f6d155ba111a9d3c78688357b15dc5e4370d42
7
- data.tar.gz: cb034408241e51d751e5bdeb37fce8015a0fbe5e8825c827d2d1b4a6a4241a8ed965e7f7a068599d91b125a8189689dd507e2df1f9da4408eb006a3c1963788b
6
+ metadata.gz: 206a547e448d6cf77996f7d288d9ef563042f7521f6c8d6918dba776fbfdb19708a7939fb8ad51087879035bcbd6273e4f50120691c084f1193d9ed24d492592
7
+ data.tar.gz: ac022203b3f4ede07c8ea8e2e7298e70e843456f7aedd7f5c86957c362de0914d234ca9e5996628eb35bddfb2479dbcc6bc9340ad635fe1990d2552a3df93570
@@ -3,3 +3,9 @@ rvm:
3
3
  - "1.9.2"
4
4
  - "1.9.3"
5
5
  - "2.0.0"
6
+ - "2.1.5"
7
+
8
+ addons:
9
+ code_climate:
10
+ repo_token:
11
+ secure: 6c7689ce08533f243c6949aabf49abada63dc24f5e1bf5c4a6dfdb20080b95fa
@@ -1,14 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- espago (0.0.9)
4
+ espago (0.1.2)
5
5
  facets
6
6
  faraday
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
+ addressable (2.3.6)
12
+ codeclimate-test-reporter (0.4.1)
13
+ simplecov (>= 0.7.1, < 1.0.0)
11
14
  coderay (1.0.8)
15
+ crack (0.4.2)
16
+ safe_yaml (~> 1.0.0)
12
17
  diff-lcs (1.1.3)
13
18
  facets (2.9.3)
14
19
  faraday (0.8.7)
@@ -46,17 +51,23 @@ GEM
46
51
  rspec-instafail (0.2.4)
47
52
  rspec-mocks (2.12.1)
48
53
  ruby-progressbar (1.0.2)
54
+ safe_yaml (1.0.4)
49
55
  simplecov (0.7.1)
50
56
  multi_json (~> 1.0)
51
57
  simplecov-html (~> 0.7.1)
52
58
  simplecov-html (0.7.1)
53
59
  slop (3.3.3)
54
60
  thor (0.16.0)
61
+ vcr (2.9.3)
62
+ webmock (1.20.4)
63
+ addressable (>= 2.3.6)
64
+ crack (>= 0.3.2)
55
65
 
56
66
  PLATFORMS
57
67
  ruby
58
68
 
59
69
  DEPENDENCIES
70
+ codeclimate-test-reporter
60
71
  espago!
61
72
  fuubar
62
73
  guard-rspec
@@ -65,3 +76,5 @@ DEPENDENCIES
65
76
  rb-fsevent (~> 0.9.1)
66
77
  rspec
67
78
  simplecov
79
+ vcr
80
+ webmock
data/Guardfile CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  guard 'rspec' do
5
5
  watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^spec/features/.+_spec\.rb$})
6
7
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
8
  watch(%r{^lib/espago/(.+)\.rb$}) { |m| "spec/espago/#{m[1]}_spec.rb" }
8
9
  watch('spec/spec_helper.rb') { "spec" }
data/README.md CHANGED
@@ -2,6 +2,9 @@ Espago gem
2
2
  ======
3
3
 
4
4
  [![Build Status](https://travis-ci.org/espago/espago.png?branch=master)](https://travis-ci.org/espago/espago)
5
+ [![Gem Version](https://badge.fury.io/rb/espago.svg)](http://badge.fury.io/rb/espago)
6
+ [![Code Climate](https://codeclimate.com/github/espago/espago/badges/gpa.svg)](https://codeclimate.com/github/espago/espago)
7
+ [![Test Coverage](https://codeclimate.com/github/espago/espago/badges/coverage.svg)](https://codeclimate.com/github/espago/espago)
5
8
 
6
9
  ### Installing Espago gem
7
10
 
@@ -11,9 +14,7 @@ or just add it to your Gemfile if you are running a Rails project
11
14
 
12
15
  ## Configuration
13
16
 
14
- After registering at <http://espago.com> configure your app with the security credentials.
15
-
16
- ### Global
17
+ After registering at <http://espago.com> configure your app with the security credentials. More information about configuration of merchant account you can find in our documentation <https://espago.com/doc/en>
17
18
 
18
19
  The most standard way of configuring Espago is to do it globally on the Espago class.
19
20
 
@@ -21,8 +22,119 @@ The most standard way of configuring Espago is to do it globally on the Espago c
21
22
  Espago.app_password = 'your-espago-secret'
22
23
  Espago.public_key = 'your-espago-key'
23
24
  Espago.production = false #sets Espago enviroment to sandbox
25
+ Espago.api_version = 2
26
+
27
+ ## Sending request
28
+
29
+ There are two possible ways of sending requests by using Espago gem.
30
+ The first possibility is to call everytime send_request() function with proper path, HTTP method and parameters.
31
+
32
+ Espago.send_request path, request_type, [parameters]
33
+
34
+ Here it is an example of using this way to create new client:
35
+
36
+ Espago.send_request :clients, :post, {description: "Jan Kowalski", email: "kowalski@example.com", card: {first_name: "Jan", last_name: "Kowalski", number: "4242424242424242", year: "2019", month: "03"}}
37
+
38
+ The second possible way to sending requests by Espago gem is to call the proper path on Espago object, using specific HTTP method and setting chosen parameteres.
39
+
40
+ Espago.path request_type, [parameters]
41
+
42
+ Below, it is an example of using this possibility to create new client:
43
+
44
+ Espago.clients :post, {description: "Jan Kowalski", email: "kowalski@example.com", card: {first_name: "Jan", last_name: "Kowalski", number: "4242424242424242", year: "2019", month: "03"}}
45
+
46
+ ## Getting response
47
+
48
+ Every returned object includes informations about header and body of response.
49
+
50
+ For example for request:
51
+
52
+ client = Espago.clients :post, {description: "Jan Kowalski", email: "kowalski@example.com", card: {first_name: "Jan", last_name: "Kowalski", number: "4242424242424242", year: "2019", month: "03"}}
53
+
54
+ Espago returns an special response object:
55
+
56
+ #<Espago::Response:0x000001038dba40
57
+ @body=
58
+ {"email"=>"kowalski@example.com",
59
+ "id"=>"cli_N2NNf85cFB1xWs",
60
+ "created_at"=>1381834598,
61
+ "description"=>"Jan Kowalski",
62
+ "card"=>
63
+ {"company"=>"VI",
64
+ "last4"=>"4242",
65
+ "year"=>2019,
66
+ "month"=>3,
67
+ "first_name"=>"Jan",
68
+ "last_name"=>"Kowalski",
69
+ "authorized"=>nil,
70
+ "created_at"=>1381834598},
71
+ "deleted"=>false},
72
+ @status=201>
73
+
74
+ To get response status code you should use "status" method.
75
+ For example
76
+
77
+ client.status
78
+
79
+ returns "201" code.
80
+
81
+ To get body of response you should use "body" method.
82
+ For example
83
+
84
+ client.body
85
+
86
+ can return hash with client details:
87
+
88
+ {
89
+ "email"=>"kowalski@example.com",
90
+ "id"=>"cli_N2NNf85cFB1xWs",
91
+ "created_at"=>1381834598,
92
+ "description"=>"Jan Kowalski",
93
+ "card"=>
94
+ {"company"=>"VI",
95
+ "last4"=>"4242",
96
+ "year"=>2019,
97
+ "month"=>3,
98
+ "first_name"=>"Jan",
99
+ "last_name"=>"Kowalski",
100
+ "authorized"=>nil,
101
+ "created_at"=>1381834598},
102
+ "deleted"=>false
103
+ }
104
+
105
+ Now if you want get customer's e-mail(or anoher field in 1st level of response) this short code should execute operation:
106
+
107
+ client.email
108
+ => "kowalski@example.com"
109
+
110
+ client.card
111
+ => {"company"=>"VI", "last4"=>"4242", "year"=>2019, "month"=>3, "first_name"=>"Jan", "last_name"=>"Kowalski", "authorized"=>nil, "created_at"=>1381834598}
24
112
 
25
- ### Sending request
113
+ ## All possible paths (resources)
26
114
 
27
- response = Espago.send_request(:clients, :get)
28
- response = Espago.clients :get
115
+ <table align="center">
116
+ <tr>
117
+ <th>Parameter</th><th>Description</th><th>Documentation link</th>
118
+ </tr>
119
+ <tr>
120
+ <th>tokens</th><td>special id for credit card</td><td>https://developers.espago.com/en/v2#44-card-tokens</td>
121
+ </tr>
122
+ <tr>
123
+ <th>clients</th><td>clients data</td><td>https://developers.espago.com/en/v2#55-customers</td>
124
+ </tr>
125
+ <tr>
126
+ <th>charges</th><td>credit payments</td><td>https://developers.espago.com/en/v2#9-card-payments</td>
127
+ </tr>
128
+ <tr>
129
+ <th>plans</th><td>plans for recurring payments</td><td>https://developers.espago.com/en/v2#22-plans</td>
130
+ </tr>
131
+ <tr>
132
+ <th>subscriptions</th><td>recurring payments for client according to the created plan</td><td>https://developers.espago.com/en/v2#28-subscriptions</td>
133
+ </tr>
134
+ <tr>
135
+ <th>invoices</th><td>single recurring payment</td><td>https://developers.espago.com/en/v2#34-invoices</td>
136
+ </tr>
137
+ <tr>
138
+ <th>line_items</th><td>element of every invoice</td><td>https://developers.espago.com/en/v2#41-getting-informations-about-line-items-of-invoice</td>
139
+ </tr>
140
+ </table>
@@ -6,7 +6,7 @@ require 'espago/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "espago"
8
8
  gem.version = Espago::VERSION
9
- gem.authors = ["Piotrek", "Szymon Fiedler"]
9
+ gem.authors = ["Piotrek", "Szymon Fiedler","Waclaw Luczak"]
10
10
  gem.email = ["developers@espago.com"]
11
11
  gem.description = %q{Espago api wrapper}
12
12
  gem.summary = %q{Espago api wrapper}
@@ -27,4 +27,9 @@ Gem::Specification.new do |gem|
27
27
  gem.add_development_dependency "fuubar"
28
28
  gem.add_development_dependency 'rake'
29
29
  gem.add_development_dependency 'rb-fsevent', '~> 0.9.1'
30
+ gem.add_development_dependency 'webmock'
31
+ gem.add_development_dependency 'vcr'
32
+ gem.add_development_dependency 'codeclimate-test-reporter'
33
+
34
+
30
35
  end
@@ -1,6 +1,7 @@
1
1
  require "espago/version"
2
2
  require "espago/client"
3
3
  require "espago/router"
4
+ require "espago/back_request"
4
5
  require 'forwardable'
5
6
 
6
7
  module Espago
@@ -8,8 +9,8 @@ module Espago
8
9
  class << self
9
10
  extend Forwardable
10
11
 
11
- def_delegators :default_client, :public_key, :app_id, :app_password, :send_request, :production
12
- def_delegators :default_client, :public_key= , :app_id= , :app_password=, :production=
12
+ def_delegators :default_client, :public_key, :app_id, :app_password, :api_version, :send_request, :production
13
+ def_delegators :default_client, :public_key= , :app_id= , :app_password=, :api_version=, :production=
13
14
 
14
15
  def method_missing(method, *args, &block)
15
16
  if Router.new(method, args[0]).path_exists?
@@ -24,4 +25,4 @@ module Espago
24
25
  @default_client ||= Espago::Client.new
25
26
  end
26
27
  end
27
- end
28
+ end
@@ -6,16 +6,28 @@ require "espago/error"
6
6
  require "espago/response"
7
7
  require "facets/kernel/require_all"
8
8
 
9
- require_all "error/*"
10
- require_all "api_connection/*"
9
+ require "espago/api_connection/api"
10
+ require "espago/api_connection/api_delete"
11
+ require "espago/api_connection/api_get"
12
+ require "espago/api_connection/api_post"
13
+ require "espago/api_connection/api_put"
14
+
15
+ begin
16
+ require_all "error/*"
17
+ require_all "api_connection/*"
18
+ rescue LoadError #if "require_all" method isn't from kernel gem
19
+ require_rel "error/*"
20
+ require_rel "api_connection/*"
21
+ end
11
22
 
12
23
  module Espago
13
24
  class ApiConnection
14
25
  extend Forwardable
15
26
  def_delegator :@connection, :basic_auth, :authenticate
16
27
 
17
- def initialize(enviroment)
28
+ def initialize(enviroment,headers)
18
29
  @connection = Faraday.new(enviroment)
30
+ @connection.headers = headers
19
31
  @router = Router
20
32
  end
21
33
 
@@ -37,7 +49,7 @@ module Espago
37
49
  when 401
38
50
  raise authentication_error(response)
39
51
  else
40
- raise api_error(response.status, response.body)
52
+ raise api_error(response)
41
53
  end
42
54
  end
43
55
 
@@ -53,8 +65,5 @@ module Espago
53
65
  ApiError.new(response)
54
66
  end
55
67
 
56
- def parse(body)
57
- JSON.parse body
58
- end
59
68
  end
60
69
  end
@@ -1,13 +1,9 @@
1
1
  module Espago
2
2
  class ApiConnection
3
- class PostClients
3
+ class Api
4
4
  def initialize(connection)
5
5
  @connection = connection
6
6
  end
7
-
8
- def request(params = {})
9
- @connection.post 'clients', params
10
- end
11
7
  end
12
8
  end
13
9
  end
@@ -0,0 +1,9 @@
1
+ module Espago
2
+ class ApiConnection
3
+ class ApiDelete < Api
4
+ def request(path, param_id=nil)
5
+ @connection.delete "#{path}/#{param_id}"
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ module Espago
2
+ class ApiConnection
3
+ class ApiGet < Api
4
+ def request(path, params = {}, param_id=nil)
5
+ if param_id
6
+ @connection.get "#{path}/#{param_id}"
7
+ else
8
+ @connection.get "#{path}", params
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module Espago
2
+ class ApiConnection
3
+ class ApiPost < Api
4
+ def request(path, params = {})
5
+ @connection.post path, params
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Espago
2
+ class ApiConnection
3
+ class ApiPut < Api
4
+ def request(path, params={})
5
+ @connection.put path, params
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Espago
2
+ class ApiConnection
3
+ class ChargesCompletePost < ApiPost
4
+ def request(params = {})
5
+ super("charges/#{params[:charge_id]}/complete")
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Espago
2
+ class ApiConnection
3
+ class ChargesDelete < ApiDelete
4
+ def request(params = {})
5
+ super("charges",params[:charge_id])
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Espago
2
+ class ApiConnection
3
+ class ChargesGet < ApiGet
4
+ def request(params = {})
5
+ super('charges',params,params[:charge_id])
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Espago
2
+ class ApiConnection
3
+ class ChargesPost < ApiPost
4
+ def request(params = {})
5
+ super("charges", params)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,10 +1,6 @@
1
1
  module Espago
2
2
  class ApiConnection
3
- class PostChargesRefund
4
- def initialize(connection)
5
- @connection = connection
6
- end
7
-
3
+ class ChargesRefundPost < Api
8
4
  def request(params = {})
9
5
  @connection.post "charges/#{params[:charge_id]}/refund", params
10
6
  end
@@ -0,0 +1,9 @@
1
+ module Espago
2
+ class ApiConnection
3
+ class ClientsAuthorizePost < ApiPost
4
+ def request(params = {})
5
+ super("clients/#{params[:client_id]}/authorize")
6
+ end
7
+ end
8
+ end
9
+ end