zoop 0.1.0 → 0.2.1
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 +4 -4
- data/lib/zoop.rb +1 -0
- data/lib/zoop/customer_common.rb +21 -0
- data/lib/zoop/resources/buyer.rb +1 -1
- data/lib/zoop/resources/seller.rb +1 -1
- data/lib/zoop/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0d43cecfc529c6d5c8415703d52d20f0ec08b2e
|
4
|
+
data.tar.gz: 5d97b630e143cb35f8c13e973c0c8b37e0b0f5a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b80a4ae0dd3e99f750c9e5a1e2456c9632e500eedf90f08dbed4249c1332f9fa3462dd858efb078d8720a0dda9459441f29f6b6bbf8c4562b4bcdcc375f2a106
|
7
|
+
data.tar.gz: dd34fda918d5a09b9d0aa6f419bc1567f8c79a9d217cc7c3aed5189b55893f08890d94d12326c37badf3e8f8e11a6e3f10652ac2c12026ba78bbb6a1e16f7770
|
data/lib/zoop.rb
CHANGED
@@ -8,6 +8,7 @@ require_relative 'zoop/nested_model'
|
|
8
8
|
require_relative 'zoop/errors'
|
9
9
|
require_relative 'zoop/request'
|
10
10
|
require_relative 'zoop/payment_method_common'
|
11
|
+
require_relative 'zoop/customer_common'
|
11
12
|
|
12
13
|
Dir[File.expand_path('../zoop/resources/*.rb', __FILE__)].map do |path|
|
13
14
|
require path
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Zoop
|
2
|
+
class CustomerCommon < Model
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def find_by_document(document)
|
7
|
+
raise RequestError.new('Invalid CPF/CNPJ') unless document.present?
|
8
|
+
|
9
|
+
raw_document = document.scan(/[0-9]/).join
|
10
|
+
document_type = raw_document.size <= 11 ? :taxpayer_id : :ein
|
11
|
+
|
12
|
+
Zoop::Request.get(
|
13
|
+
url('search'),
|
14
|
+
headers: { 'Content-Type' => '' },
|
15
|
+
query: { document_type => raw_document }
|
16
|
+
).call
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
data/lib/zoop/resources/buyer.rb
CHANGED
data/lib/zoop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zoop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Mageste
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- bin/console
|
142
142
|
- lib/zoop.rb
|
143
143
|
- lib/zoop/core_ext.rb
|
144
|
+
- lib/zoop/customer_common.rb
|
144
145
|
- lib/zoop/errors.rb
|
145
146
|
- lib/zoop/model.rb
|
146
147
|
- lib/zoop/nested_model.rb
|