cobrato-client 0.26.0 → 0.27.0

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: ab666ea641bad0be10d7f5ab5951de0ac0cc9791
4
- data.tar.gz: 1afee00451ab8769e03de88aad0fbd30b20eda19
3
+ metadata.gz: 6d909230cc248c276cf6e14e417062685d4ea161
4
+ data.tar.gz: 67526eeffba24270aebfa2220e9664448656d906
5
5
  SHA512:
6
- metadata.gz: d3d4375130a23903c26b8cb670067da560412a81f7176cb149d9d341b29930e06e37f04c0b73ebec36ca3fe0b812c2445b9bdd64336788c942d7abcb752c79e9
7
- data.tar.gz: 1b044d793aecf7e99e9d4782691736dec7b5745326b6968709e8c843bec6cb81a77988f8f3da090542465b1e5b2d73ebcaac65a2ae288a3754ff5faeafee90a2
6
+ metadata.gz: 94d90ba7e8b43dc639fd8bc141bc62e28eede68762827b0c3811363a7db21abb6ab984d9c7865ea92748fa3331cf9de2eaa71bbd554a66802d643562cb9ac2de
7
+ data.tar.gz: 02d9196f4612099e8254760e826812f40776eee86cd573317dc5c8e8ccfbd30b00a44e0c06f694d7bfb023e92f8f140da4fe7179e44594019d6de8b9a31fbbba
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## v0.27.0
6
+
7
+ - Add `people` endpoints
8
+ - `payers#create` is now DEPRECATED. Use `people#create` instead
9
+ - `payers#list` is now DEPRECATED. Use `people#list` instead
10
+ - `payers#show` is now DEPRECATED. Use `people#show` instead
11
+ - `payers#update` is now DEPRECATED. Use `people#update` instead
12
+
5
13
  ## v0.26.0
6
14
 
7
15
  - Fix changing the RegressCnab and RemittaceCnab attribute `file_name` to `filename`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cobrato-client (0.26.0)
4
+ cobrato-client (0.27.0)
5
5
  multi_json (~> 1.11)
6
6
  typhoeus (~> 0.8.0)
7
7
  virtus (~> 1.0.5)
@@ -27,7 +27,7 @@ GEM
27
27
  equalizer (0.0.11)
28
28
  ethon (0.11.0)
29
29
  ffi (>= 1.3.0)
30
- ffi (1.9.23)
30
+ ffi (1.9.25)
31
31
  ice_nine (0.11.2)
32
32
  json (2.0.2)
33
33
  method_source (0.8.2)
@@ -84,4 +84,4 @@ DEPENDENCIES
84
84
  vcr (~> 2.9)
85
85
 
86
86
  BUNDLED WITH
87
- 1.16.1
87
+ 1.16.2
data/README.md CHANGED
@@ -52,7 +52,8 @@ Now you have acess to every API endpoint:
52
52
 
53
53
  * [Payees API](http://docs.cobrato.com/#benefici-rio)
54
54
  * [Bank Accounts API](http://docs.cobrato.com/#conta-banc-ria)
55
- * [Payers API](http://docs.cobrato.com/#pagador)
55
+ * [People API](http://docs.cobrato.com/#pessoa)
56
+ * [Payers API](http://docs.cobrato.com/#pagador) (DEPRECATED)
56
57
  * [Charge Configs API](http://docs.cobrato.com/#configura-o-de-cobran-a)
57
58
  * [Charges API](http://docs.cobrato.com/#cobran-a)
58
59
  * [Regress Cnab](http://docs.cobrato.com/#cnab-de-retorno)
@@ -85,7 +86,16 @@ Now you have acess to every API endpoint:
85
86
  | DELETE | [api/v1/bank_accounts/:id](http://docs.cobrato.com/#exclus-o-de-conta-banc-ria) | client.bank_accounts.destroy |
86
87
  | GET | [api/v1/bank_accounts/portfolio_codes](http://docs.cobrato.com/#carteiras-dispon-veis) | client.bank_accounts.portfolio_codes |
87
88
 
88
- #### [Payers](http://docs.cobrato.com/#pagador)
89
+ #### [People](http://docs.cobrato.com/#pessoa)
90
+
91
+ | HTTP method | Endpoint | Client method |
92
+ | ----------- | --------------------------------------------------------------------| --------------------- |
93
+ | POST | [api/v1/people](http://docs.cobrato.com/#cria-o-de-pessoa) | client.people.create |
94
+ | GET | [api/v1/people](http://docs.cobrato.com/#lista-de-todos-as-pessoas) | client.people.list |
95
+ | GET | [api/v1/people/:id](http://docs.cobrato.com/#informa-es-da-pessoa) | client.people.show |
96
+ | PUT | [api/v1/people/:id](http://docs.cobrato.com/#atualiza-o-de-pessoa) | client.people.update |
97
+
98
+ #### [Payers](http://docs.cobrato.com/#pagador) (DEPRECATED)
89
99
 
90
100
  | HTTP method | Endpoint | Client method |
91
101
  | ----------- | --------------------------------------------------------------------- | --------------------- |
data/lib/cobrato.rb CHANGED
@@ -12,6 +12,7 @@ require "cobrato/entities/base"
12
12
  require "cobrato/entities/cnab"
13
13
  require "cobrato/entities/payee"
14
14
  require "cobrato/entities/payer"
15
+ require "cobrato/entities/person"
15
16
  require "cobrato/entities/bank_account"
16
17
  require "cobrato/entities/charge_config"
17
18
  require "cobrato/entities/payment_config"
@@ -27,6 +28,7 @@ require "cobrato/entities/charge_template"
27
28
  require "cobrato/resources/base"
28
29
  require "cobrato/resources/payee"
29
30
  require "cobrato/resources/payer"
31
+ require "cobrato/resources/person"
30
32
  require "cobrato/resources/bank_account"
31
33
  require "cobrato/resources/charge_config"
32
34
  require "cobrato/resources/payment_config"
@@ -63,6 +63,10 @@ module Cobrato
63
63
  Resources::Payer.new(http)
64
64
  end
65
65
 
66
+ def people
67
+ Resources::Person.new(http)
68
+ end
69
+
66
70
  def charge_templates
67
71
  Resources::ChargeTemplate.new(http)
68
72
  end
@@ -12,6 +12,13 @@ module Cobrato
12
12
  attribute :number, String
13
13
  attribute :complement, String
14
14
  attribute :street, String
15
+
16
+ %i[national_identifier name].each do |method|
17
+ define_method method do |*args|
18
+ puts "Warning: '#{self.class.name}##{method}' is deprecated. See API docs for more info."
19
+ super(*args)
20
+ end
21
+ end
15
22
  end
16
23
  end
17
- end
24
+ end
@@ -0,0 +1,17 @@
1
+ module Cobrato
2
+ module Entities
3
+ class Person < Base
4
+ attribute :id, Integer
5
+ attribute :national_identifier_type, String
6
+ attribute :national_identifier, String
7
+ attribute :name, String
8
+ attribute :zipcode, String
9
+ attribute :city, String
10
+ attribute :state, String
11
+ attribute :neighbourhood, String
12
+ attribute :number, String
13
+ attribute :complement, String
14
+ attribute :street, String
15
+ end
16
+ end
17
+ end
@@ -110,7 +110,7 @@ module Cobrato
110
110
 
111
111
 
112
112
  def underscore_pluralized(str)
113
- "#{str.gsub(/(.)([A-Z])/, '\1_\2').downcase}s"
113
+ irregular_resource_name || "#{str.gsub(/(.)([A-Z])/, '\1_\2').downcase}s"
114
114
  end
115
115
 
116
116
  def deprecate(params, deprecated)
@@ -118,6 +118,9 @@ module Cobrato
118
118
  puts "Warning: The '#{a}' param is deprecated. See Cobrato API docs for more info."
119
119
  end
120
120
  end
121
+
122
+ # Define at child class when is irregular
123
+ def irregular_resource_name; end
121
124
  end
122
125
  end
123
126
  end
@@ -2,6 +2,19 @@ module Cobrato
2
2
  module Resources
3
3
  class Payer < Base
4
4
  crud :show, :list, :create, :update
5
+
6
+ %w[show list create update].each do |method|
7
+ define_method method do |*args|
8
+ puts "Warning: The #{self.class.name}##{method} method is depracated. See Cobrato API docs for more info"
9
+ super(*args)
10
+ end
11
+ end
12
+
13
+ protected
14
+
15
+ def irregular_resource_name
16
+ "people"
17
+ end
5
18
  end
6
19
  end
7
- end
20
+ end
@@ -0,0 +1,13 @@
1
+ module Cobrato
2
+ module Resources
3
+ class Person < Base
4
+ crud :show, :list, :create, :update
5
+
6
+ protected
7
+
8
+ def irregular_resource_name
9
+ "people"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Cobrato
2
- VERSION = '0.26.0'
2
+ VERSION = '0.27.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobrato-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcio Ricardo Santos
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2018-05-28 00:00:00.000000000 Z
13
+ date: 2018-06-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: typhoeus
@@ -206,6 +206,7 @@ files:
206
206
  - lib/cobrato/entities/payer.rb
207
207
  - lib/cobrato/entities/payment.rb
208
208
  - lib/cobrato/entities/payment_config.rb
209
+ - lib/cobrato/entities/person.rb
209
210
  - lib/cobrato/entities/regress_cnab.rb
210
211
  - lib/cobrato/entities/remittance_cnab.rb
211
212
  - lib/cobrato/entities/webhook.rb
@@ -224,6 +225,7 @@ files:
224
225
  - lib/cobrato/resources/payer.rb
225
226
  - lib/cobrato/resources/payment.rb
226
227
  - lib/cobrato/resources/payment_config.rb
228
+ - lib/cobrato/resources/person.rb
227
229
  - lib/cobrato/resources/regress_cnab.rb
228
230
  - lib/cobrato/resources/remittance_cnab.rb
229
231
  - lib/cobrato/resources/webhook.rb
@@ -250,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
252
  version: '0'
251
253
  requirements: []
252
254
  rubyforge_project:
253
- rubygems_version: 2.6.13
255
+ rubygems_version: 2.5.2.1
254
256
  signing_key:
255
257
  specification_version: 4
256
258
  summary: This is the official Ruby client for the Cobrato API.