easybill 0.2.21 → 0.2.22

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
  SHA1:
3
- metadata.gz: c118ec30890f5d76a08a4120796255ba0d7fa245
4
- data.tar.gz: d4f5e13867771aadfbd1d7aba87a881963ad0176
3
+ metadata.gz: 7de497b23a234c45715ca9631c86faa14639761e
4
+ data.tar.gz: 3f530737b1893119d3f2efb48ff8264a42375a13
5
5
  SHA512:
6
- metadata.gz: 8b0fe6177d840fd5b9f4e4635519a9ff624dae9f54086aefb6a4f2abaf978ab0c6cb781ccdf333186143caea74a9ddca43c5faeb26cfedf47c955f0cfedddb18
7
- data.tar.gz: 3ee4d7075182c1725d426ab53cb6772f01b85e0f123b938b8c0472364773858dd9acb7568539687299b1604c85b531876205af7f8e95330b8f7627529e590754
6
+ metadata.gz: 72b3c422836b5207212d3c5d7d40fde229f09dc3f74a2caaac741ca1ecce6e44e9170ea0b3b20919d24c4d69e4259704235cbfcb11fa613d42d22a15bb08897f
7
+ data.tar.gz: e25b2c7594fe262072360d35e141bb7f8017e5cc67bed27878a92e88c853f16c6b3ee9e46320d52b0ac722502855462c515c6aa1e9ad41dd9bd936567896cb5d
@@ -1 +1 @@
1
- 2.2.1
1
+ 2.2.3
data/circle.yml CHANGED
@@ -1,3 +1,6 @@
1
+ dependencies:
2
+ post:
3
+ - bundle update
1
4
  test:
2
5
  pre:
3
6
  - bundle exec rake rubocop
@@ -18,7 +18,7 @@ module Easybill
18
18
  get_document_pdf: { op_name: 'getDocumentPDF', result_type: 'document' },
19
19
  create_dunning: { op_name: 'createDunning', result_type: 'document' },
20
20
  get_document_sent: { op_name: 'getDocumentSent', result_type: 'document' }
21
- }
21
+ }.freeze
22
22
 
23
23
  def initialize(options = {})
24
24
  @options = Easybill.configuration.merge(options)
@@ -11,14 +11,14 @@ module Easybill
11
11
  def initialize
12
12
  OPTIONS.each do |option|
13
13
  env_key = "EASYBILL_#{option.upcase}"
14
- send("#{option}=", ENV[env_key]) if ENV[env_key]
14
+ public_send("#{option}=", ENV[env_key]) if ENV[env_key]
15
15
  end
16
16
  end
17
17
 
18
18
  # Public: Returns a hash of all configurable options.
19
19
  def to_hash
20
20
  Hash[OPTIONS.map do |option|
21
- [option, send(option)]
21
+ [option, public_send(option)]
22
22
  end]
23
23
  end
24
24
 
@@ -28,7 +28,7 @@ module Easybill
28
28
  #
29
29
  # Returns the value of the requested attribute
30
30
  def[](key)
31
- send(key) if OPTIONS.include?(key)
31
+ public_send(key) if OPTIONS.include?(key)
32
32
  end
33
33
 
34
34
  # Public
@@ -2,6 +2,8 @@ require 'php_serialize'
2
2
 
3
3
  module Easybill
4
4
  class Document < OpenStruct
5
+ class ParseError < StandardError; end
6
+
5
7
  def service_period
6
8
  plain_service_date = PHP.unserialize(service_date)
7
9
 
@@ -14,6 +16,8 @@ module Easybill
14
16
  plain_service_date['serviceDateString']
15
17
  end
16
18
  end
19
+ rescue TypeError => e
20
+ raise ParseError, e
17
21
  end
18
22
 
19
23
  def service_period_end
@@ -1,3 +1,3 @@
1
1
  module Easybill
2
- VERSION = '0.2.21'
2
+ VERSION = '0.2.22'.freeze
3
3
  end
@@ -21,6 +21,14 @@ describe Easybill::Document do
21
21
 
22
22
  it { is_expected.to eq('') }
23
23
  end
24
+
25
+ context 'when parsing data is malformed' do
26
+ let(:document) { described_class.new('service_date' => '{}') }
27
+
28
+ it 'throws Easybill::Document::ParseError exception' do
29
+ expect { subject }.to raise_error(Easybill::Document::ParseError, 'Unable to unserialize type \'{\'')
30
+ end
31
+ end
24
32
  end
25
33
 
26
34
  describe '#service_period_end' do
@@ -1,6 +1,6 @@
1
1
  RSpec::Matchers.define :have_overridable_attribute do |attribute_name, valid_value = 'a value'|
2
2
  match do |actual|
3
- actual.send("#{attribute_name}=", valid_value)
4
- actual.send(attribute_name) == valid_value
3
+ actual.public_send("#{attribute_name}=", valid_value)
4
+ actual.public_send(attribute_name) == valid_value
5
5
  end
6
6
  end
@@ -21,7 +21,7 @@ module MethodInterceptor
21
21
  #
22
22
  def intercept(klass, method_name, &block)
23
23
  singleton = klass.singleton_class
24
- singleton.send(:alias_method, :"#{method_name}_original", method_name)
24
+ singleton.__send__(:alias_method, :"#{method_name}_original", method_name)
25
25
  allow(klass).to receive(method_name) do |*args|
26
26
  block.call(klass.method(:"#{method_name}_original"), *args)
27
27
  end
@@ -48,7 +48,7 @@ module MethodInterceptor
48
48
  # end
49
49
  #
50
50
  def intercept_any_instance_of(klass, method_name, &block)
51
- klass.send(:alias_method, :"#{method_name}_original", method_name)
51
+ klass.__send__(:alias_method, :"#{method_name}_original", method_name)
52
52
  allow_any_instance_of(klass).to receive(method_name) do |instance, *args|
53
53
  block.call(instance.method(:"#{method_name}_original"), *args)
54
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easybill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.21
4
+ version: 0.2.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - ad2games GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-20 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sekken
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  version: '0'
231
231
  requirements: []
232
232
  rubyforge_project:
233
- rubygems_version: 2.4.5
233
+ rubygems_version: 2.4.5.1
234
234
  signing_key:
235
235
  specification_version: 4
236
236
  summary: A client library to the SOAP API of Easybill.de