easybill 0.2.21 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/circle.yml +3 -0
- data/lib/easybill/client.rb +1 -1
- data/lib/easybill/configuration.rb +3 -3
- data/lib/easybill/document.rb +4 -0
- data/lib/easybill/version.rb +1 -1
- data/spec/easybill/document_spec.rb +8 -0
- data/spec/support/matchers.rb +2 -2
- data/spec/support/method_interceptor.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7de497b23a234c45715ca9631c86faa14639761e
|
4
|
+
data.tar.gz: 3f530737b1893119d3f2efb48ff8264a42375a13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72b3c422836b5207212d3c5d7d40fde229f09dc3f74a2caaac741ca1ecce6e44e9170ea0b3b20919d24c4d69e4259704235cbfcb11fa613d42d22a15bb08897f
|
7
|
+
data.tar.gz: e25b2c7594fe262072360d35e141bb7f8017e5cc67bed27878a92e88c853f16c6b3ee9e46320d52b0ac722502855462c515c6aa1e9ad41dd9bd936567896cb5d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.3
|
data/circle.yml
CHANGED
data/lib/easybill/client.rb
CHANGED
@@ -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
|
-
|
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,
|
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
|
-
|
31
|
+
public_send(key) if OPTIONS.include?(key)
|
32
32
|
end
|
33
33
|
|
34
34
|
# Public
|
data/lib/easybill/document.rb
CHANGED
@@ -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
|
data/lib/easybill/version.rb
CHANGED
@@ -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
|
data/spec/support/matchers.rb
CHANGED
@@ -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.
|
4
|
-
actual.
|
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.
|
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.
|
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.
|
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-
|
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
|