rconomic 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +11 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +54 -0
- data/LICENSE +19 -0
- data/README.md +74 -0
- data/Rakefile +7 -0
- data/lib/economic/current_invoice.rb +78 -0
- data/lib/economic/current_invoice_line.rb +47 -0
- data/lib/economic/debtor.rb +51 -0
- data/lib/economic/economic.wsdl +56858 -0
- data/lib/economic/entity.rb +167 -0
- data/lib/economic/proxies/current_invoice_line_proxy.rb +28 -0
- data/lib/economic/proxies/current_invoice_proxy.rb +38 -0
- data/lib/economic/proxies/debtor_proxy.rb +40 -0
- data/lib/economic/proxies/entity_proxy.rb +61 -0
- data/lib/economic/session.rb +59 -0
- data/lib/rconomic/version.rb +3 -0
- data/lib/rconomic.rb +26 -0
- data/rconomic.gemspec +26 -0
- data/spec/economic/current_invoice_line_spec.rb +10 -0
- data/spec/economic/current_invoice_spec.rb +59 -0
- data/spec/economic/debtor_spec.rb +43 -0
- data/spec/economic/entity_spec.rb +179 -0
- data/spec/economic/proxies/current_invoice_line_proxy_spec.rb +77 -0
- data/spec/economic/proxies/current_invoice_proxy_spec.rb +64 -0
- data/spec/economic/proxies/debtor_proxy_spec.rb +74 -0
- data/spec/economic/session_spec.rb +64 -0
- data/spec/fixtures/connect/success.xml +8 -0
- data/spec/fixtures/current_invoice_create_from_data/success.xml +10 -0
- data/spec/fixtures/current_invoice_get_data/success.xml +73 -0
- data/spec/fixtures/current_invoice_line_get_data/success.xml +39 -0
- data/spec/fixtures/debtor_find_by_ci_number/many.xml +15 -0
- data/spec/fixtures/debtor_get_data/success.xml +54 -0
- data/spec/fixtures/debtor_get_next_available_number/success.xml +8 -0
- data/spec/fixtures/spec_entity_create_from_data/success.xml +10 -0
- data/spec/fixtures/spec_entity_get_data/success.xml +11 -0
- data/spec/fixtures/spec_entity_update_from_data/success.xml +10 -0
- data/spec/fixtures/wsdl.xml +56596 -0
- data/spec/spec_helper.rb +97 -0
- metadata +135 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'savon'
|
2
|
+
require 'savon_spec'
|
3
|
+
require './lib/rconomic'
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.mock_with :mocha
|
7
|
+
config.include Savon::Spec::Macros
|
8
|
+
|
9
|
+
config.before :each do
|
10
|
+
# Ensure we don't actually send requests over the network
|
11
|
+
HTTPI.expects(:get).never
|
12
|
+
HTTPI.expects(:post).never
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
Savon.configure do |config|
|
18
|
+
config.logger = Logger.new(File.join('spec', 'debug.log'))
|
19
|
+
end
|
20
|
+
|
21
|
+
Savon::Spec::Fixture.path = File.expand_path("../fixtures", __FILE__)
|
22
|
+
|
23
|
+
# Stub the WSDL instead of fetching it over the wire
|
24
|
+
module Savon
|
25
|
+
module Wasabi
|
26
|
+
class Document < ::Wasabi::Document
|
27
|
+
def resolve_document
|
28
|
+
Savon::Spec::Fixture['wsdl']
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
class Savon::Spec::Mock
|
36
|
+
# Fix issue with savon_specs #with method, so that it allows other values than the expected.
|
37
|
+
# Without this, savon_spec 0.1.6 doesn't work with savon 0.9.3.
|
38
|
+
#
|
39
|
+
# savon.expects('Connect').with(has_entries(:agreementNumber => 123456)).returns(:success)
|
40
|
+
#
|
41
|
+
# would trigger a irrelevant
|
42
|
+
#
|
43
|
+
# Mocha::ExpectationError: unexpected invocation: #<AnyInstance:Savon::SOAP::XML>.body=(nil)
|
44
|
+
def with(soap_body)
|
45
|
+
if mock_method == :expects
|
46
|
+
Savon::SOAP::XML.any_instance.stubs(:body=)
|
47
|
+
Savon::SOAP::XML.any_instance.expects(:body=).with(soap_body)
|
48
|
+
end
|
49
|
+
self
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def make_session
|
54
|
+
Economic::Session.new(123456, 'api', 'passw0rd')
|
55
|
+
end
|
56
|
+
|
57
|
+
def make_current_invoice(properties = {})
|
58
|
+
invoice = make_debtor.current_invoices.build
|
59
|
+
|
60
|
+
# Assign specified properties
|
61
|
+
properties.each { |key, value|
|
62
|
+
invoice.send("#{key}=", value)
|
63
|
+
}
|
64
|
+
|
65
|
+
# Use defaults for the rest of the properties
|
66
|
+
invoice.date ||= Time.now
|
67
|
+
invoice.due_date ||= Time.now + 15
|
68
|
+
invoice.exchange_rate ||= 100
|
69
|
+
invoice.is_vat_included ||= false
|
70
|
+
|
71
|
+
invoice
|
72
|
+
end
|
73
|
+
|
74
|
+
def make_debtor(properties = {})
|
75
|
+
debtor = Economic::Debtor.new
|
76
|
+
|
77
|
+
# Assign specified properties
|
78
|
+
properties.each { |key, value|
|
79
|
+
debtor.send("#{key}=", value)
|
80
|
+
}
|
81
|
+
|
82
|
+
# Use defaults for the rest of the properties
|
83
|
+
debtor.session ||= make_session
|
84
|
+
debtor.handle ||= { :number => 42 }
|
85
|
+
debtor.number ||= 42
|
86
|
+
debtor.debtor_group_handle || { :number => 1 }
|
87
|
+
debtor.name ||= 'Bob'
|
88
|
+
debtor.vat_zone ||= 'HomeCountry' # HomeCountry, EU, Abroad
|
89
|
+
debtor.currency_handle ||= { :code => 'DKK' }
|
90
|
+
debtor.price_group_handle ||= { :number => 1 }
|
91
|
+
debtor.is_accessible ||= true
|
92
|
+
debtor.ci_number ||= '12345678'
|
93
|
+
debtor.term_of_payment_handle ||= { :id => 1 }
|
94
|
+
debtor.layout_handle ||= { :id => 16 }
|
95
|
+
|
96
|
+
debtor
|
97
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rconomic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jakob Skjerning
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-08-02 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: savon
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - "="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 49
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 9
|
33
|
+
- 5
|
34
|
+
version: 0.9.5
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: activesupport
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 7
|
46
|
+
segments:
|
47
|
+
- 3
|
48
|
+
- 0
|
49
|
+
version: "3.0"
|
50
|
+
type: :runtime
|
51
|
+
version_requirements: *id002
|
52
|
+
description: " Ruby wrapper for the e-conomic SOAP API, that aims at making working with the API bearable.\n\n E-conomic is a web-based accounting system. For their marketing speak, see http://www.e-conomic.co.uk/about/. More details about their API at http://www.e-conomic.co.uk/integration/integration-partner/.\n"
|
53
|
+
email: jakob@mentalized.net
|
54
|
+
executables: []
|
55
|
+
|
56
|
+
extensions: []
|
57
|
+
|
58
|
+
extra_rdoc_files: []
|
59
|
+
|
60
|
+
files:
|
61
|
+
- .travis.yml
|
62
|
+
- Gemfile
|
63
|
+
- Gemfile.lock
|
64
|
+
- LICENSE
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- lib/economic/current_invoice.rb
|
68
|
+
- lib/economic/current_invoice_line.rb
|
69
|
+
- lib/economic/debtor.rb
|
70
|
+
- lib/economic/economic.wsdl
|
71
|
+
- lib/economic/entity.rb
|
72
|
+
- lib/economic/proxies/current_invoice_line_proxy.rb
|
73
|
+
- lib/economic/proxies/current_invoice_proxy.rb
|
74
|
+
- lib/economic/proxies/debtor_proxy.rb
|
75
|
+
- lib/economic/proxies/entity_proxy.rb
|
76
|
+
- lib/economic/session.rb
|
77
|
+
- lib/rconomic.rb
|
78
|
+
- lib/rconomic/version.rb
|
79
|
+
- rconomic.gemspec
|
80
|
+
- spec/economic/current_invoice_line_spec.rb
|
81
|
+
- spec/economic/current_invoice_spec.rb
|
82
|
+
- spec/economic/debtor_spec.rb
|
83
|
+
- spec/economic/entity_spec.rb
|
84
|
+
- spec/economic/proxies/current_invoice_line_proxy_spec.rb
|
85
|
+
- spec/economic/proxies/current_invoice_proxy_spec.rb
|
86
|
+
- spec/economic/proxies/debtor_proxy_spec.rb
|
87
|
+
- spec/economic/session_spec.rb
|
88
|
+
- spec/fixtures/connect/success.xml
|
89
|
+
- spec/fixtures/current_invoice_create_from_data/success.xml
|
90
|
+
- spec/fixtures/current_invoice_get_data/success.xml
|
91
|
+
- spec/fixtures/current_invoice_line_get_data/success.xml
|
92
|
+
- spec/fixtures/debtor_find_by_ci_number/many.xml
|
93
|
+
- spec/fixtures/debtor_get_data/success.xml
|
94
|
+
- spec/fixtures/debtor_get_next_available_number/success.xml
|
95
|
+
- spec/fixtures/spec_entity_create_from_data/success.xml
|
96
|
+
- spec/fixtures/spec_entity_get_data/success.xml
|
97
|
+
- spec/fixtures/spec_entity_update_from_data/success.xml
|
98
|
+
- spec/fixtures/wsdl.xml
|
99
|
+
- spec/spec_helper.rb
|
100
|
+
has_rdoc: true
|
101
|
+
homepage: https://github.com/lokalebasen/rconomic
|
102
|
+
licenses: []
|
103
|
+
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
hash: 3
|
115
|
+
segments:
|
116
|
+
- 0
|
117
|
+
version: "0"
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
hash: 3
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
version: "0"
|
127
|
+
requirements: []
|
128
|
+
|
129
|
+
rubyforge_project:
|
130
|
+
rubygems_version: 1.6.2
|
131
|
+
signing_key:
|
132
|
+
specification_version: 3
|
133
|
+
summary: Wrapper for e-conomic.dk's SOAP API.
|
134
|
+
test_files: []
|
135
|
+
|