asaas-ruby 0.2.17 → 0.2.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94a8d6b0afba265529e845becfadc043fdc70b3c3346726c34b97188b0365885
4
- data.tar.gz: 1f8b083270382ab6fc2f7ac07273f69287a58400cf0d3b857353e279ed8b5a47
3
+ metadata.gz: 0dd811d70deee95872c2f97b1d72affb8b76ed1ae9f29f9e8ead2e8017a43309
4
+ data.tar.gz: 199bdb9a806540e89a5a756c41300f2ff324018cff4fce69ff929bf6975cb6b5
5
5
  SHA512:
6
- metadata.gz: a0a15a87bada9387a1d0a43a418e3f8a33f8e3d34d472f244424114f9045063550c3e75d9d8f7edaf2a89969e25073bcd6f7d8f87772e8d39133dad867bf5112
7
- data.tar.gz: f778d7b10e0d7b4571f04c943ceb58cee7e31537c49495a5bcc7e308a2cfc974176d7b1b34ea833ebf569b056361de02cb993ead2be7c1492ac16ea016f8ed11
6
+ metadata.gz: 8852d4cf92d4cc18307a2e0ad561d55a261f865b318f1ac6e66d28edd3bfdb3f5e1963322951c835715b3bc8bdb5b930da1a656156f6664e98f72ab53940090d
7
+ data.tar.gz: 52ca4fb2cf3b529f841d4b939a98302c0f5f58927b4d2452ba81dfa24eed79dd070ba6ad3e8bb336afce1bdbdcd628a6c5ee2c856a4e76829456a6a95bdd9536
data/README.md CHANGED
@@ -21,6 +21,8 @@ gem build asaas-ruby.gemspec
21
21
 
22
22
  ### Changelog
23
23
 
24
+ - 0.2.18 - Account documents upload
25
+ - 0.2.17 -
24
26
  - 0.2.16 - Wallet account tranfers
25
27
  - 0.2.15 - Bank account tranfers
26
28
 
@@ -14,7 +14,6 @@ module Asaas
14
14
  @route = route
15
15
  @api_version = api_version || Asaas::Configuration.api_version
16
16
  @endpoint = Asaas::Configuration.get_endpoint(api_version)
17
- puts @endpoint
18
17
  end
19
18
 
20
19
  def extract_meta(meta)
@@ -94,7 +93,7 @@ module Asaas
94
93
  method: method,
95
94
  body: body,
96
95
  params: params,
97
- headers: {
96
+ headers: {
98
97
  'access_token': @token || Asaas::Configuration.token,
99
98
  'Content-Type': 'application/json'
100
99
  },
@@ -156,4 +155,4 @@ module Asaas
156
155
  end
157
156
  end
158
157
  end
159
- end
158
+ end
@@ -0,0 +1,33 @@
1
+ module Asaas
2
+ module Api
3
+ class Documents < Asaas::Api::Base
4
+
5
+ def initialize(token)
6
+ super(token, 2, '/documents')
7
+ end
8
+
9
+ def upload(document_type, group_type, file)
10
+ group_types = %w[ASAAS_ACCOUNT_OWNER PARTNER LIMITED_COMPANY]
11
+ types = %w[IDENTIFICATION SOCIAL_CONTRACT]
12
+
13
+ raise ArgumentError, 'Wrong document_type' unless types.include? document_type
14
+ raise ArgumentError, 'Wrong group_type' unless group_types.include? group_type
15
+
16
+ @response = Typhoeus.post(URI(endpoint + route).to_s,
17
+ body: {
18
+ documentType: document_type
19
+ documentGroupType: group_type,
20
+ documentFile: file
21
+ },
22
+ headers: {
23
+ 'access_token': @token || Asaas::Configuration.token,
24
+ 'Content-Type': 'multipart/form-data'
25
+ },
26
+ verbose: Asaas::Configuration.debug
27
+ )
28
+ @response
29
+ end
30
+
31
+ end
32
+ end
33
+ end
@@ -40,5 +40,9 @@ module Asaas
40
40
  @webhooks ||= Asaas::Api::Webhook.new(@token, @api_version)
41
41
  end
42
42
 
43
+ def documents
44
+ @documents ||= Asaas::Api::Document.new(@token)
45
+ end
46
+
43
47
  end
44
48
  end
@@ -7,7 +7,7 @@ module Asaas
7
7
  }
8
8
 
9
9
  ENDPOINT_HOMOLOG = {
10
- v2: 'https://homolog.asaas.com/api/v2',
10
+ v2: 'https://sandbox.asaas.com/api/v2',
11
11
  v3: 'https://sandbox.asaas.com/api/v3',
12
12
  }
13
13
 
@@ -12,6 +12,7 @@ module Asaas
12
12
  attribute :complement, Types::Coercible::String.optional
13
13
  attribute :province, Types::Coercible::String.optional
14
14
  attribute :postalCode, Types::Coercible::String.optional
15
- attribute :apiKey, Types::Coercible::String.optional.default(nil)
15
+ attribute :apiKey, Types::Coercible::String.optional.default(nil)
16
+ attribute :companyType, Types::Coercible::String.optional.default(nil)
16
17
  end
17
18
  end
@@ -1,3 +1,3 @@
1
1
  module Asaas
2
- VERSION = "0.2.17"
2
+ VERSION = "0.2.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asaas-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.17
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Junior
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-12 00:00:00.000000000 Z
11
+ date: 2020-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -232,6 +232,7 @@ files:
232
232
  - lib/asaas/api/base.rb
233
233
  - lib/asaas/api/city.rb
234
234
  - lib/asaas/api/customer.rb
235
+ - lib/asaas/api/documents.rb
235
236
  - lib/asaas/api/notification.rb
236
237
  - lib/asaas/api/payment.rb
237
238
  - lib/asaas/api/subscription.rb