hbci 0.3.1 → 0.3.2

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: 6d8863eaee26a37c3a6abe14db9196ffdded7a0c556ba1f16e96b9359b7c208a
4
- data.tar.gz: 2384b7d356861ba1100e0ffe94da7818d209e06d380882a11b25e6e6c6b7c340
3
+ metadata.gz: 561835270d94e66ef6062e37eb5636086adcb8d8ed0b88740bf9fb88716a1508
4
+ data.tar.gz: 36f7ba79371222b6d91fa1754052ea89f5bc72d9657f2c7cf1111c867efa70fe
5
5
  SHA512:
6
- metadata.gz: 6aa8166bb31112f62d23eeca4f43df2d3fe700885559b613444459f07d0efca42d091e5612b87f2b44394b652cc9a4fcbd7e5e4421744077a86ff80f5f1a02ac
7
- data.tar.gz: 5e18b33710be68bba1b1688c02ad86ee2e46aba6a807671c9227d8f80c7137738c189260bfc4fe782ed3d6831217e0c111d78f7b208e781989bb0c0166098647
6
+ metadata.gz: cffbfa1831358127ecffcea548e79243a484e216a045566ddb92345f0a7da69de932b8da39befcdb148f875566bfb862ea89de1b321caf40074e142945166f14
7
+ data.tar.gz: 219ac32f77934db6916cd024eeb1c201c49f4cacc597726d346c82dfb103bdd2fbd4b951fe73814579f17a8b9491f38ef4dfb007d59bf7ac00c4084ec82dfb2f
@@ -12,8 +12,7 @@ Metrics/ModuleLength:
12
12
 
13
13
  Metrics/LineLength:
14
14
  Exclude:
15
- - spec/support/message_stubs.rb
16
- - spec/support/request_stubs.rb
15
+ - spec/**/*
17
16
 
18
17
  Metrics/AbcSize:
19
18
  Exclude:
@@ -24,3 +23,7 @@ Metrics/ParameterLists:
24
23
  - spec/support/message_stubs.rb
25
24
  - spec/support/request_stubs.rb
26
25
 
26
+
27
+ Lint/UnusedMethodArgument:
28
+ Exclude:
29
+ - spec/support/*
@@ -23,4 +23,4 @@ Metrics/MethodLength:
23
23
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
24
24
  # URISchemes: http, https
25
25
  Metrics/LineLength:
26
- Max: 117
26
+ Max: 150
@@ -14,4 +14,3 @@ Hbci::Connector.open(@credentials) do |connector|
14
14
  end
15
15
  end
16
16
  end
17
-
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_runtime_dependency 'bank_credentials'
22
- spec.add_runtime_dependency 'cmxl', '~> 1.1'
22
+ spec.add_runtime_dependency 'cmxl', '~> 1.2'
23
23
  spec.add_runtime_dependency 'httparty', '~> 0.16'
24
24
  spec.add_runtime_dependency 'ibanizator', '~> 0.3'
25
25
  spec.add_runtime_dependency 'monetize', ['>=1.8', '<2.0.0']
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'bundler', '~> 1.10'
30
30
  spec.add_development_dependency 'byebug', '~> 10.0'
31
31
  spec.add_development_dependency 'rake', '~> 12.3'
32
- spec.add_development_dependency 'rspec', '~> 3.7'
33
- spec.add_development_dependency 'rubocop', '~> 0.57'
32
+ spec.add_development_dependency 'rspec', '~> 3.8'
33
+ spec.add_development_dependency 'rubocop', '~> 0.60'
34
34
  spec.add_development_dependency 'timecop', '~> 0.9'
35
35
  spec.add_development_dependency 'webmock', '~> 3.4'
36
36
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Hbci
2
4
  class Connector
3
5
  attr_accessor :message_number
@@ -16,6 +18,7 @@ module Hbci
16
18
 
17
19
  def credentials=(credentials)
18
20
  raise ArgumentError, "#{self.class.name}#initialize expects a BankCredentials::Hbci object" unless credentials.is_a?(BankCredentials::Hbci)
21
+
19
22
  credentials.validate!
20
23
  @credentials = credentials
21
24
  end
@@ -28,6 +31,7 @@ module Hbci
28
31
  req = HTTParty.post(@credentials.url, body: request_message.to_base64)
29
32
  @message_number += 1
30
33
  raise "Error in https communication with bank: #{req.response.inspect}" unless req.success?
34
+
31
35
  Base64.decode64(req.response.body)
32
36
  end
33
37
  end
@@ -66,6 +66,7 @@ module Hbci
66
66
  index = index_for_element(potential_element_name)
67
67
  if index
68
68
  return set_element(potential_element_name, args.first) if is_writer && args.count == 1
69
+
69
70
  return get_element(potential_element_name)
70
71
  end
71
72
 
@@ -19,7 +19,7 @@ module Hbci
19
19
  end
20
20
 
21
21
  def compile
22
- @segments.each_with_index do |segment, index|
22
+ @segments.each_with_index do |segment, _index|
23
23
  segment.compile
24
24
  unless segment.head.position
25
25
  segment.head.position = @next_position
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Hbci
2
4
  module MessageFactory
3
5
  def self.build(connector, dialog)
@@ -31,7 +31,7 @@ module Hbci
31
31
  # ) end of look-ahead
32
32
  # ------------------------------------------------------------------------
33
33
  # ) end of \1
34
- ELEMENT_REGEX = /(.*?(?=(?<!\?)[:+']))/
34
+ ELEMENT_REGEX = /(.*?(?=(?<!\?)[:+']))/.freeze
35
35
 
36
36
  # Binary Elements may contain unescaped delimiters. Thus they are not
37
37
  # terminated by regular delimiters. But their content is preceeded with
@@ -40,7 +40,7 @@ module Hbci
40
40
  # '@6@mydata' or '@12@mydatamydata'
41
41
  #
42
42
  # The BINARY_ELEMENT_LENGTH_REGEx matches only the length.
43
- BINARY_ELEMENT_LENGTH_REGEX = /@(\d+)@/
43
+ BINARY_ELEMENT_LENGTH_REGEX = /@(\d+)@/.freeze
44
44
 
45
45
  def self.parse(string)
46
46
  new(string).parse
@@ -76,6 +76,7 @@ module Hbci
76
76
  def parse_delimiter
77
77
  delimiter = scanner.getch
78
78
  return if scanner.eos?
79
+
79
80
  if delimiter == ELEMENT_GROUP_DELIMITER
80
81
  add_element_group
81
82
  elsif delimiter == SEGMENT_DELIMITER
@@ -1,4 +1,3 @@
1
-
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Hbci
@@ -15,7 +14,7 @@ module Hbci
15
14
  end
16
15
 
17
16
  def find_all(segment_type)
18
- @raw_segments.select { |sd| sd[0][0] == segment_type }.map{ |sd| Hbci::SegmentFactory.build(sd) }
17
+ @raw_segments.select { |sd| sd[0][0] == segment_type }.map { |sd| Hbci::SegmentFactory.build(sd) }
19
18
  end
20
19
 
21
20
  def to_s
@@ -46,8 +46,7 @@ module Hbci
46
46
  define_element_groups
47
47
  end
48
48
 
49
- def compile
50
- end
49
+ def compile; end
51
50
 
52
51
  def to_s
53
52
  element_groups.join('+').gsub(/\+*$/, '') << '\''
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Hbci
2
4
  module Segments
3
5
  class HIRMGv2 < Segment
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Hbci
2
4
  module Segments
3
5
  class HISYNv4 < Segment
@@ -13,7 +13,7 @@ module Hbci
13
13
  element :state, default: 1
14
14
 
15
15
  def compile
16
- self.bank.code = request_message.connector.credentials.bank_code
16
+ bank.code = request_message.connector.credentials.bank_code
17
17
  self.user_id = request_message.connector.credentials.user_id
18
18
  self.system_id = request_message.dialog ? request_message.dialog.system_id : 0
19
19
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Hbci
2
4
  module Segments
3
5
  class HKSYNv3 < Segment
@@ -63,8 +63,8 @@ module Hbci
63
63
 
64
64
  def compile
65
65
  self.security_reference = request_message.sec_ref
66
- self.security_identification_details.party_identification = request_message.dialog ? request_message.dialog.system_id : 0
67
- self.tan_mechanism = request_message.dialog.tan_mechanism if request_message.dialog && request_message.dialog.tan_mechanism
66
+ security_identification_details.party_identification = request_message.dialog ? request_message.dialog.system_id : 0
67
+ self.tan_mechanism = request_message.dialog.tan_mechanism if request_message.dialog&.tan_mechanism
68
68
  set_credentials
69
69
  end
70
70
 
@@ -22,7 +22,7 @@ module Hbci
22
22
 
23
23
  def find_all(segment_type)
24
24
  @raw_segments = Parser.parse(content)
25
- @raw_segments.select { |sd| sd[0][0] == segment_type }.map{ |sd| Hbci::SegmentFactory.build(sd) }
25
+ @raw_segments.select { |sd| sd[0][0] == segment_type }.map { |sd| Hbci::SegmentFactory.build(sd) }
26
26
  end
27
27
 
28
28
  def add_segment(segment)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hbci
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hbci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Lehnert
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-01 00:00:00.000000000 Z
12
+ date: 2018-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bank_credentials
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.1'
34
+ version: '1.2'
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
- version: '1.1'
41
+ version: '1.2'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: httparty
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -169,28 +169,28 @@ dependencies:
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: '3.7'
172
+ version: '3.8'
173
173
  type: :development
174
174
  prerelease: false
175
175
  version_requirements: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '3.7'
179
+ version: '3.8'
180
180
  - !ruby/object:Gem::Dependency
181
181
  name: rubocop
182
182
  requirement: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: '0.57'
186
+ version: '0.60'
187
187
  type: :development
188
188
  prerelease: false
189
189
  version_requirements: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - "~>"
192
192
  - !ruby/object:Gem::Version
193
- version: '0.57'
193
+ version: '0.60'
194
194
  - !ruby/object:Gem::Dependency
195
195
  name: timecop
196
196
  requirement: !ruby/object:Gem::Requirement