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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f599cdb12d9866e02b787c3f7655bde7cc48c3eeec67b56587f8d01127ea0cd
4
- data.tar.gz: e10dffebc13c36d528884a66a4acbff2c36b2a6d1569dd143069d7bc3c7fd86e
3
+ metadata.gz: cb00ef2078b07c28f27e67e9eac4503412f6f226fc680dc46ba7e1ca41d3a819
4
+ data.tar.gz: 6c9deaed75e5f3bb5ee31f70fd756cd16b9a80633980b31dff386b380e622b57
5
5
  SHA512:
6
- metadata.gz: ba2f99bb1ba971230eead369fcb65e06e939ca006286fbf5a533e392d5af654cd14c46ee9bea19d258c59deff4e6845dc22825e7c6aeff1edd708f733e53c7c6
7
- data.tar.gz: c9715bb8098c5994e5ba8f753b9337b2955c03d1c348440252e0cd57db3df94b92d87d910a8d87efb6fbbd895d8b0693f47fb4501f2872fb6152b03a53bdbdb0
6
+ metadata.gz: 1354650b100039d8692d117eaeaf79e3271e2ec178d6b0044372d7fed337ac614bec81296b31db6dea6549fc74ab151ac18fdfbf6af37fdd6f9cab0293169d15
7
+ data.tar.gz: 48943f8b8ad265ea87beefc3764a36e7a4dead8868054c5664b337513e34579044ea12848e026352917812f4bf668e285c36e8f7a17335ffb54f70dce15e3f5e
@@ -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'
@@ -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
@@ -19,7 +19,7 @@ JSON keys)
19
19
 
20
20
  Yard Documentation
21
21
  -------------------
22
- https://www.rubydoc.info/gems/arstotzka/1.4.2
22
+ https://www.rubydoc.info/gems/arstotzka/1.4.3
23
23
 
24
24
  Instalation
25
25
  ---------------
@@ -96,6 +96,7 @@ module Arstotzka
96
96
  # @return [TrueClass,FalseClass]
97
97
  def ==(other)
98
98
  return false unless other.class == self.class
99
+
99
100
  options == other.options
100
101
  end
101
102
 
@@ -64,7 +64,7 @@ module Arstotzka
64
64
  when /^@@.*/
65
65
  instance.class.class_variable_get(json)
66
66
  when /^@.*/
67
- then instance.instance_variable_get(json)
67
+ instance.instance_variable_get(json)
68
68
  else
69
69
  instance.send(json)
70
70
  end
@@ -62,6 +62,7 @@ module Arstotzka
62
62
  # @see #check_key!
63
63
  def key?
64
64
  return unless hash
65
+
65
66
  hash.key?(key) || hash.key?(key.to_sym)
66
67
  end
67
68
 
@@ -294,6 +294,7 @@ module Arstotzka
294
294
  # @return [TrueClass,FalseClass]
295
295
  def ==(other)
296
296
  return false unless other.class == self.class
297
+
297
298
  to_h == other.to_h
298
299
  end
299
300
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Arstotzka
4
- VERSION = '1.4.2'
4
+ VERSION = '1.4.3'
5
5
  end
@@ -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: 10,
11
- person: {
10
+ id: 10,
11
+ person: {
12
12
  name: 'Robert',
13
- age: 22
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' }
@@ -38,7 +38,7 @@ describe Arstotzka::Crawler do
38
38
  let(:hash) do
39
39
  {
40
40
  'companies' => [{
41
- name: 'Lucas Pope',
41
+ name: 'Lucas Pope',
42
42
  games: [{
43
43
  'name' => 'papers, please'
44
44
  }, {
@@ -40,13 +40,13 @@ describe Arstotzka::FetcherBuilder do
40
40
  {
41
41
  teams: [
42
42
  {
43
- name: 'Team War',
43
+ name: 'Team War',
44
44
  players: [
45
45
  { person_id: 101 },
46
46
  { person_id: 102 }
47
47
  ]
48
48
  }, {
49
- name: 'Team not War',
49
+ name: 'Team not War',
50
50
  players: [
51
51
  { person_id: 201 },
52
52
  { person_id: 202 }
@@ -10,8 +10,8 @@ describe Arstotzka::PostProcessor do
10
10
 
11
11
  let(:options) do
12
12
  {
13
- after: :create_employes,
14
- flatten: true,
13
+ after: :create_employes,
14
+ flatten: true,
15
15
  instance: company
16
16
  }
17
17
  end
@@ -5,10 +5,10 @@ describe Arstotzka::TypeCast do
5
5
 
6
6
  let(:hash) do
7
7
  {
8
- age: '10',
8
+ age: '10',
9
9
  payload: { 'key' => 'value' },
10
- price: '1.75',
11
- type: 'type_a'
10
+ price: '1.75',
11
+ type: 'type_a'
12
12
  }
13
13
  end
14
14
 
@@ -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: NilClass,
93
- string: 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: NilClass,
101
- string: Arstotzka::Wrapper::Dummy
100
+ float: NilClass,
101
+ string: Arstotzka::Wrapper::Dummy
102
102
  end
103
103
  end
104
104
 
@@ -23,8 +23,8 @@ describe Arstotzka do
23
23
  let(:instance) { klass.new({}) }
24
24
  let(:expected) do
25
25
  Arstotzka::Fetcher.new(
26
- key: :name,
27
- path: 'user',
26
+ key: :name,
27
+ path: 'user',
28
28
  instance: instance
29
29
  )
30
30
  end
@@ -26,6 +26,7 @@ module Arstotzka
26
26
 
27
27
  def ==(other)
28
28
  return false unless other.class == self.class
29
+
29
30
  json == other.json
30
31
  end
31
32
  end
@@ -15,6 +15,7 @@ class Collector
15
15
 
16
16
  def ==(other)
17
17
  return false if other.class != self.class
18
+
18
19
  name == other.name && played == other.played
19
20
  end
20
21
 
@@ -14,6 +14,7 @@ class Customer
14
14
 
15
15
  def ==(other)
16
16
  return false unless other.class == self.class
17
+
17
18
  other.name == name &&
18
19
  other.age == age
19
20
  end
@@ -14,6 +14,7 @@ class Drink
14
14
 
15
15
  def ==(other)
16
16
  return false unless other.class == self.class
17
+
17
18
  other.name == name &&
18
19
  other.price == price
19
20
  end
@@ -15,6 +15,7 @@ class Employe
15
15
 
16
16
  def ==(other)
17
17
  return unless other.class == self.class
18
+
18
19
  other.name == name &&
19
20
  other.age == age &&
20
21
  other.company == company
@@ -4,7 +4,7 @@ class Office
4
4
  include Arstotzka
5
5
 
6
6
  expose :employes, full_path: 'employes.first_name',
7
- compact: true
7
+ compact: true
8
8
 
9
9
  def initialize(hash)
10
10
  @hash = hash
@@ -9,6 +9,7 @@ class Person
9
9
 
10
10
  def ==(other)
11
11
  return false unless other.class == self.class
12
+
12
13
  other.name == name
13
14
  end
14
15
  end
@@ -14,6 +14,7 @@ class Star
14
14
 
15
15
  def ==(other)
16
16
  return false unless other.is_a?(self.class)
17
+
17
18
  other.color == color &&
18
19
  other.name == name
19
20
  end
@@ -14,6 +14,7 @@ class Transaction
14
14
 
15
15
  def ==(other)
16
16
  return false unless other.class == self.class
17
+
17
18
  other.value == value && other.type == type
18
19
  end
19
20
  end
@@ -15,6 +15,6 @@ end
15
15
  shared_examples 'casts basic types' do
16
16
  it_behaves_like 'a result that is type cast',
17
17
  integer: Integer,
18
- float: Float,
19
- string: String
18
+ float: Float,
19
+ string: String
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arstotzka
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darthjee