arstotzka 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -4
- data/.rubocop_todo.yml +0 -50
- data/README.md +1 -1
- data/lib/arstotzka/fetcher.rb +1 -0
- data/lib/arstotzka/hash_reader.rb +1 -1
- data/lib/arstotzka/key_reader.rb +1 -0
- data/lib/arstotzka/options.rb +1 -0
- data/lib/arstotzka/version.rb +1 -1
- data/lib/arstotzka/wrapper.rb +2 -0
- data/spec/integration/readme/my_parser_spec.rb +4 -4
- data/spec/integration/yard/arstotzka/crawler_spec.rb +1 -1
- data/spec/integration/yard/arstotzka/fetcher_builder_spec.rb +2 -2
- data/spec/integration/yard/arstotzka/post_processor_spec.rb +2 -2
- data/spec/integration/yard/arstotzka/type_cast_spec.rb +3 -3
- data/spec/lib/arstotzka/options_spec.rb +2 -0
- data/spec/lib/arstotzka/wrapper_spec.rb +4 -4
- data/spec/lib/arstotzka_spec.rb +2 -2
- data/spec/support/models/arstotzka/dummy.rb +1 -0
- data/spec/support/models/collector/game.rb +1 -0
- data/spec/support/models/customer.rb +1 -0
- data/spec/support/models/drink.rb +1 -0
- data/spec/support/models/employe.rb +1 -0
- data/spec/support/models/office.rb +1 -1
- data/spec/support/models/person.rb +1 -0
- data/spec/support/models/star.rb +1 -0
- data/spec/support/models/transaction.rb +1 -0
- data/spec/support/shared_examples/wrapper.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb00ef2078b07c28f27e67e9eac4503412f6f226fc680dc46ba7e1ca41d3a819
|
4
|
+
data.tar.gz: 6c9deaed75e5f3bb5ee31f70fd756cd16b9a80633980b31dff386b380e622b57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1354650b100039d8692d117eaeaf79e3271e2ec178d6b0044372d7fed337ac614bec81296b31db6dea6549fc74ab151ac18fdfbf6af37fdd6f9cab0293169d15
|
7
|
+
data.tar.gz: 48943f8b8ad265ea87beefc3764a36e7a4dead8868054c5664b337513e34579044ea12848e026352917812f4bf668e285c36e8f7a17335ffb54f70dce15e3f5e
|
data/.rubocop.yml
CHANGED
@@ -4,10 +4,6 @@ inherit_from: .rubocop_todo.yml
|
|
4
4
|
AllCops:
|
5
5
|
TargetRubyVersion: 2.5
|
6
6
|
|
7
|
-
Metrics/BlockLength:
|
8
|
-
Exclude:
|
9
|
-
- 'spec/**/*_spec.rb'
|
10
|
-
|
11
7
|
Metrics/LineLength:
|
12
8
|
Max: 100
|
13
9
|
|
@@ -21,3 +17,12 @@ Style/ClassAndModuleChildren:
|
|
21
17
|
Style/ClassVars:
|
22
18
|
Exclude:
|
23
19
|
- spec/support/models/arstotzka/fetcher/class_variable.rb
|
20
|
+
|
21
|
+
Layout/AlignHash:
|
22
|
+
EnforcedColonStyle: table
|
23
|
+
|
24
|
+
Metrics/BlockLength:
|
25
|
+
Exclude:
|
26
|
+
- 'spec/**/*_spec.rb'
|
27
|
+
- 'spec/support/**/*.rb'
|
28
|
+
- '*.gemspec'
|
data/.rubocop_todo.yml
CHANGED
@@ -6,56 +6,6 @@
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 55
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
12
|
-
# SupportedHashRocketStyles: key, separator, table
|
13
|
-
# SupportedColonStyles: key, separator, table
|
14
|
-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
15
|
-
Layout/AlignHash:
|
16
|
-
Exclude:
|
17
|
-
- 'lib/arstotzka/config.rb'
|
18
|
-
- 'spec/integration/yard/arstotzka/config_spec.rb'
|
19
|
-
- 'spec/integration/yard/arstotzka/fetcher_builder_spec.rb'
|
20
|
-
- 'spec/integration/yard/arstotzka/fetcher_spec.rb'
|
21
|
-
- 'spec/lib/arstotzka/config_spec.rb'
|
22
|
-
- 'spec/lib/arstotzka/fetcher_spec.rb'
|
23
|
-
- 'spec/lib/arstotzka/options_spec.rb'
|
24
|
-
|
25
|
-
# Offense count: 13
|
26
|
-
# Cop supports --auto-correct.
|
27
|
-
Layout/EmptyLineAfterGuardClause:
|
28
|
-
Exclude:
|
29
|
-
- 'lib/arstotzka/fetcher.rb'
|
30
|
-
- 'lib/arstotzka/key_reader.rb'
|
31
|
-
- 'lib/arstotzka/options.rb'
|
32
|
-
- 'lib/arstotzka/wrapper.rb'
|
33
|
-
- 'spec/support/models/arstotzka/dummy.rb'
|
34
|
-
- 'spec/support/models/collector/game.rb'
|
35
|
-
- 'spec/support/models/customer.rb'
|
36
|
-
- 'spec/support/models/drink.rb'
|
37
|
-
- 'spec/support/models/employe.rb'
|
38
|
-
- 'spec/support/models/person.rb'
|
39
|
-
- 'spec/support/models/star.rb'
|
40
|
-
- 'spec/support/models/transaction.rb'
|
41
|
-
|
42
|
-
# Offense count: 1
|
43
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
44
|
-
# ExcludedMethods: refine
|
45
|
-
Metrics/BlockLength:
|
46
|
-
Max: 31
|
47
|
-
|
48
|
-
# Offense count: 1
|
49
|
-
RSpec/AnyInstance:
|
50
|
-
Exclude:
|
51
|
-
- 'spec/lib/arstotzka/options_spec.rb'
|
52
|
-
|
53
9
|
# Offense count: 78
|
54
10
|
RSpec/NestedGroups:
|
55
11
|
Max: 5
|
56
|
-
|
57
|
-
# Offense count: 1
|
58
|
-
# Cop supports --auto-correct.
|
59
|
-
Style/MultilineWhenThen:
|
60
|
-
Exclude:
|
61
|
-
- 'lib/arstotzka/hash_reader.rb'
|
data/README.md
CHANGED
data/lib/arstotzka/fetcher.rb
CHANGED
data/lib/arstotzka/key_reader.rb
CHANGED
data/lib/arstotzka/options.rb
CHANGED
data/lib/arstotzka/version.rb
CHANGED
data/lib/arstotzka/wrapper.rb
CHANGED
@@ -59,6 +59,7 @@ module Arstotzka
|
|
59
59
|
# request.payload # returns '{"key"=>"value"}'
|
60
60
|
def wrap(value)
|
61
61
|
return wrap_array(value) if value.is_a?(Array)
|
62
|
+
|
62
63
|
wrap_element(value)
|
63
64
|
end
|
64
65
|
|
@@ -123,6 +124,7 @@ module Arstotzka
|
|
123
124
|
# @return [Object] instance of +options.klass+
|
124
125
|
def wrap_in_class(value)
|
125
126
|
return value unless klass
|
127
|
+
|
126
128
|
klass.new(value)
|
127
129
|
end
|
128
130
|
|
@@ -7,17 +7,17 @@ describe MyParser do
|
|
7
7
|
|
8
8
|
let(:hash) do
|
9
9
|
{
|
10
|
-
id:
|
11
|
-
person:
|
10
|
+
id: 10,
|
11
|
+
person: {
|
12
12
|
name: 'Robert',
|
13
|
-
age:
|
13
|
+
age: 22
|
14
14
|
},
|
15
15
|
accounts: [
|
16
16
|
{ balance: '$ 1000.50', type: 'checking' },
|
17
17
|
{ balance: '$ 150.10', type: 'savings' },
|
18
18
|
{ balance: '$ -100.24', type: 'checking' }
|
19
19
|
],
|
20
|
-
loans:
|
20
|
+
loans: [
|
21
21
|
{ value: '$ 300.50', bank: 'the_bank' },
|
22
22
|
{ value: '$ 150.10', type: 'the_other_bank' },
|
23
23
|
{ value: '$ 100.24', type: 'the_same_bank' }
|
@@ -40,13 +40,13 @@ describe Arstotzka::FetcherBuilder do
|
|
40
40
|
{
|
41
41
|
teams: [
|
42
42
|
{
|
43
|
-
name:
|
43
|
+
name: 'Team War',
|
44
44
|
players: [
|
45
45
|
{ person_id: 101 },
|
46
46
|
{ person_id: 102 }
|
47
47
|
]
|
48
48
|
}, {
|
49
|
-
name:
|
49
|
+
name: 'Team not War',
|
50
50
|
players: [
|
51
51
|
{ person_id: 201 },
|
52
52
|
{ person_id: 202 }
|
@@ -160,10 +160,12 @@ describe Arstotzka::Options do
|
|
160
160
|
end
|
161
161
|
|
162
162
|
describe '#klass' do
|
163
|
+
# rubocop:disable RSpec/AnyInstance
|
163
164
|
before do
|
164
165
|
allow_any_instance_of(described_class)
|
165
166
|
.to receive(:warn)
|
166
167
|
end
|
168
|
+
# rubocop:enable RSpec/AnyInstance
|
167
169
|
|
168
170
|
context 'when initializing with old class key' do
|
169
171
|
let(:options_hash) { { class: Star } }
|
@@ -89,16 +89,16 @@ describe Arstotzka::Wrapper do
|
|
89
89
|
|
90
90
|
it_behaves_like 'a result that is type cast',
|
91
91
|
integer: NilClass,
|
92
|
-
float:
|
93
|
-
string:
|
92
|
+
float: NilClass,
|
93
|
+
string: String
|
94
94
|
|
95
95
|
context 'when passing klass parameter' do
|
96
96
|
let(:options) { { type: type, klass: Arstotzka::Wrapper::Dummy } }
|
97
97
|
|
98
98
|
it_behaves_like 'a result that is type cast',
|
99
99
|
integer: NilClass,
|
100
|
-
float:
|
101
|
-
string:
|
100
|
+
float: NilClass,
|
101
|
+
string: Arstotzka::Wrapper::Dummy
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
data/spec/lib/arstotzka_spec.rb
CHANGED
data/spec/support/models/star.rb
CHANGED