boa_vista 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- N2NiOTk2YTgzM2U2ODc5MWFhOWEzMTA0NjQ2YWQxMzRhMzgwNzYzYw==
5
- data.tar.gz: !binary |-
6
- MmVmYjA4NDk3NDVmMmIwMGRjYzg4NTJmN2E4OGQ4NjcyMGVlNjczYg==
2
+ SHA1:
3
+ metadata.gz: 7174c497d64c0e11b49cae8bf8a0098c6f2417b2
4
+ data.tar.gz: 537175544ae85858db5646609b60aa75dd3c88d2
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- OTE5MDcwMDUyNGQ2MGQyY2UwNjZjYTJlYjEzZTE1MjEyNjM5ZmRkMmZmNTZj
10
- YjAxOTU2NTc0MzRiZTk1NDk2YjMxYTBmOTQ5Mzk4YTY0YTc2ZDNlZTU2YmRh
11
- NDJmZGE5Nzc2NTAxMjE5ZTMzNjUzNjlhOWUxMzk5MmE1ZjJkZDM=
12
- data.tar.gz: !binary |-
13
- YTcwNzliYTgxYzU5NTI1NTU4YjM4ODlhMzQyODYyMjU4ZTVjNjFhNDEzNWE5
14
- Y2QwNjU5NjQ1ZWI5M2JmYmM5YzMxMDYyNWEyZjM0ZGUwYmQxZTIzNTAxZDU5
15
- MTg1YWY5YzM5MGZiMjIxYTE4N2RmNWQ4ZmI3Y2NjODAyMWRjNmY=
6
+ metadata.gz: c4cd27910d666dc4976af69f07a7e8758fdbb50e189e21d53c52c9c0308d1d20715aafdbab56f7d01c8e9844d029c0120787c8a186c322fefb7f63943aed5743
7
+ data.tar.gz: 49eb484fa4b1398e677782fa6f6e6101f6f24875b1e5ed655bf6db6cffac5d6d1c2600c83f9511c8f1732a933424fb1c52ec92b8ba80bcc9dde05e538d24b431
data/README.md CHANGED
@@ -35,7 +35,6 @@ If you are using Rails add this code in config/initializers
35
35
  Considering a variable(attributes) equal to this:
36
36
  ```ruby
37
37
  attributes = {
38
- document_type: '1',
39
38
  document_number: '00031030944410'
40
39
  }.merge(BoaVista::Request::Default::CPF)
41
40
  ```
@@ -5,7 +5,7 @@ module BoaVista
5
5
  def initialize(name, options = {})
6
6
  @name = name
7
7
  @range = options.fetch(:range)
8
- @value = options.fetch(:value, '')
8
+ @value = options.fetch(:value, '').to_s
9
9
  end
10
10
 
11
11
  def size
@@ -7,12 +7,16 @@ module BoaVista
7
7
  acc = (args + default_args).reverse.inject({}) do |acc, attrs|
8
8
  acc.merge(attrs)
9
9
  end
10
- acc[:document_number] = acc[:document_number].rjust(14, '0')
11
- acc
10
+ adjust_attribute(acc, :document_number, 14, '0')
12
11
  end
13
12
 
14
13
  protected
15
14
 
15
+ def adjust_attribute(hash, attribute, char_number, value)
16
+ hash[attribute] = hash[attribute].to_s.rjust(char_number, value)
17
+ hash
18
+ end
19
+
16
20
  def default_args
17
21
  [
18
22
  BoaVista::Request::Default::DEFAULT,
@@ -1,3 +1,3 @@
1
1
  module BoaVista
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end
@@ -9,7 +9,6 @@ RSpec.describe BoaVista::Client do
9
9
  let(:url_stub) { "http://localhost:3000/?consulta=CSR60%20%20%2001%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20CODE%20%20%20%20PASSWORDSINTON%20%20012C100031030944410X" }
10
10
  let(:values) do
11
11
  {
12
- document_type: '1',
13
12
  document_number: '00031030944410'
14
13
  }.merge(BoaVista::Request::Default::CPF)
15
14
  end
@@ -46,6 +45,28 @@ RSpec.describe BoaVista::Client do
46
45
  expect { subject }.to raise_error(BoaVista::Errors::Timeout)
47
46
  end
48
47
  end
48
+
49
+ context 'when code is an integer' do
50
+ let(:url_stub) { 'http://localhost:3000/?consulta=CSR60%20%20%2001%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%202347382%20PASSWORDSINTON%20%20012C100031030944410X' }
51
+ let(:values) do
52
+ {
53
+ code: 2347382,
54
+ document_number: '00031030944410'
55
+ }.merge(BoaVista::Request::Default::CPF)
56
+ end
57
+
58
+ its(:record_type) { is_expected.to eq('353') }
59
+ end
60
+
61
+ context 'when an field is an integer' do
62
+ let(:values) do
63
+ {
64
+ document_number: 31030944410
65
+ }.merge(BoaVista::Request::Default::CPF)
66
+ end
67
+
68
+ its(:record_type) { is_expected.to eq('353') }
69
+ end
49
70
  end
50
71
 
51
72
  end
@@ -1,3 +1,3 @@
1
1
  RSpec.describe BoaVista::VERSION do
2
- specify { expect(BoaVista::VERSION).to eq '0.0.12' }
2
+ specify { expect(BoaVista::VERSION).to eq '0.0.13' }
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boa_vista
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Souza
@@ -9,104 +9,104 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-22 00:00:00.000000000 Z
12
+ date: 2016-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ! '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ! '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: faraday
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ! '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ! '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: codeclimate-test-reporter
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ! '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ! '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: webmock
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ! '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ! '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ! '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ! '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rspec-its
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ! '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ! '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ! '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ! '>='
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  description: Client for Boa Vista
@@ -205,17 +205,17 @@ require_paths:
205
205
  - lib
206
206
  required_ruby_version: !ruby/object:Gem::Requirement
207
207
  requirements:
208
- - - ! '>='
208
+ - - ">="
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - ! '>='
213
+ - - ">="
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  requirements: []
217
217
  rubyforge_project:
218
- rubygems_version: 2.4.8
218
+ rubygems_version: 2.4.6
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: Client for Boa Vista
@@ -266,3 +266,4 @@ test_files:
266
266
  - spec/lib/boa_vista/response_spec.rb
267
267
  - spec/lib/boa_vista/version_spec.rb
268
268
  - spec/spec_helper.rb
269
+ has_rdoc: