axis 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.rspec +0 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +10 -0
- data/Rakefile +5 -0
- data/VERSION +1 -0
- data/axis.gemspec +31 -0
- data/db/schema/v_customers.sql +228 -0
- data/db/schema/v_deliveries.sql +146 -0
- data/db/schema/v_nominal_account_transactions.sql +179 -0
- data/db/schema/v_sales_order_lines.sql +156 -0
- data/db/schema/v_sales_orders.sql +256 -0
- data/db/schema/v_stock_records.sql +243 -0
- data/lib/axis.rb +15 -0
- data/lib/axis/base.rb +5 -0
- data/lib/axis/config.rb +28 -0
- data/lib/axis/document.rb +74 -0
- data/lib/axis/models/addressee.rb +6 -0
- data/lib/axis/models/component_record.rb +5 -0
- data/lib/axis/models/customer.rb +6 -0
- data/lib/axis/models/delivery.rb +7 -0
- data/lib/axis/models/goods_on_account.rb +8 -0
- data/lib/axis/models/goods_on_account_line.rb +8 -0
- data/lib/axis/models/invoice.rb +11 -0
- data/lib/axis/models/nominal_account_transaction.rb +47 -0
- data/lib/axis/models/sales_order.rb +7 -0
- data/lib/axis/models/sales_order_line.rb +8 -0
- data/lib/axis/models/stock_level.rb +6 -0
- data/lib/axis/models/stock_record.rb +10 -0
- data/lib/axis/models/stock_record_location.rb +6 -0
- data/lib/axis/models/supplier_price.rb +6 -0
- data/lib/axis/version.rb +3 -0
- data/lib/cli.rb +25 -0
- data/spec/axis/document_spec.rb +98 -0
- data/spec/fixtures/ATTACH/Documents/INV/123456_0_20110101_163350_2C16B3CB_P.pdf +0 -0
- data/spec/fixtures/ATTACH/Documents/INV/123456_0_20120101_163350_2C16B3CB_P.pdf +0 -0
- data/spec/fixtures/ATTACH/Documents/INV/123456_0_20121002_163350_2C16B3CB_P.pdf +0 -0
- data/spec/fixtures/ATTACH/Documents/INV/296621_0_20121001_163350_2C16B3CB_P.pdf +0 -0
- data/spec/spec_helper.rb +1 -0
- metadata +175 -0
data/lib/axis/version.rb
ADDED
data/lib/cli.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'axis'
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
ActiveRecord::Base.establish_connection(
|
5
|
+
:adapter => 'sqlserver',
|
6
|
+
:dataserver => '192.168.254.118',
|
7
|
+
:host => '192.168.254.118',
|
8
|
+
:database => 'AXIS33238CO1',
|
9
|
+
:username => 'sa',
|
10
|
+
:password => 'St1nky1nk'
|
11
|
+
)
|
12
|
+
|
13
|
+
Squeel.configure do |config|
|
14
|
+
config.load_core_extensions :hash, :symbol
|
15
|
+
end
|
16
|
+
|
17
|
+
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
18
|
+
|
19
|
+
# Crud way of reloading model code.
|
20
|
+
def reload!
|
21
|
+
load 'axis/base.rb'
|
22
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'axis/models/*')).each { |f| load f }
|
23
|
+
end
|
24
|
+
|
25
|
+
include Axis # Make axis namespace available to irb scope
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Axis::Document::Base do
|
4
|
+
|
5
|
+
subject { Axis::Document::Base.new(path) }
|
6
|
+
|
7
|
+
context "with an invoice" do
|
8
|
+
let(:path) {'/ATTACH/Documents/INV/296443_0_20121001_163350_2C16B3CB_P.pdf'}
|
9
|
+
|
10
|
+
its(:id) { should eql("296443") }
|
11
|
+
its(:type) { should eql(:invoice) }
|
12
|
+
its(:path) { should eql(Pathname.new(path))}
|
13
|
+
its(:created_on) { should eql(Date.new(2012,10,01)) }
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
describe Axis::Document::Invoice do
|
19
|
+
|
20
|
+
describe "#find" do
|
21
|
+
subject { Axis::Document::Invoice.find(id) }
|
22
|
+
|
23
|
+
context "with a document that exists" do
|
24
|
+
let(:id) {296621}
|
25
|
+
|
26
|
+
it { should be_an(Axis::Document::Invoice) }
|
27
|
+
its(:type) { should eql(:invoice) }
|
28
|
+
its(:created_on) { should eql(Date.new(2012,10,01)) }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "with a document that does not exist" do
|
32
|
+
let(:id) {9999}
|
33
|
+
|
34
|
+
it "should raise an Axis::Document::DocumentNotFound error"do
|
35
|
+
expect {
|
36
|
+
Axis::Document::Invoice.find(id)
|
37
|
+
}.to raise_error(Axis::Document::DocumentNotFound)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "with an empty id" do
|
42
|
+
let(:id) {""}
|
43
|
+
|
44
|
+
it "should raise an ArgumentError"do
|
45
|
+
expect {
|
46
|
+
Axis::Document::Invoice.find(id)
|
47
|
+
}.to raise_error(ArgumentError)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "#find_by_date" do
|
53
|
+
|
54
|
+
subject { Axis::Document::Invoice.find_by_date(*date) }
|
55
|
+
|
56
|
+
context "with the arguments 2012" do
|
57
|
+
let(:date) { [2012] }
|
58
|
+
|
59
|
+
it {should be_a(Array) }
|
60
|
+
its(:length) { should eql(3) }
|
61
|
+
|
62
|
+
it "should return all documents created in 2012" do
|
63
|
+
subject.each {|x|
|
64
|
+
x.created_on.year.should eql(2012)
|
65
|
+
}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context "with the arguments 2012, 10" do
|
70
|
+
let(:date) { [2012, 10] }
|
71
|
+
|
72
|
+
it {should be_a(Array) }
|
73
|
+
its(:length) { should eql(2) }
|
74
|
+
|
75
|
+
it "should return all documents created in October 2012" do
|
76
|
+
subject.each {|x|
|
77
|
+
x.created_on.year.should eql(2012)
|
78
|
+
x.created_on.month.should eql(10)
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context "with the arguments 2012, 10, 11" do
|
84
|
+
let(:date) { [2012, 10, 1] }
|
85
|
+
|
86
|
+
it {should be_a(Array) }
|
87
|
+
its(:length) { should eql(1) }
|
88
|
+
|
89
|
+
it "should return all documents created on 11 October 2012" do
|
90
|
+
subject.each {|x|
|
91
|
+
x.created_on.year.should eql(2012)
|
92
|
+
x.created_on.month.should eql(10)
|
93
|
+
x.created_on.day.should eql(1)
|
94
|
+
}
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'axis'
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: axis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Robert Williams
|
9
|
+
- Rich Grundy
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-10-17 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - '='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.8.7
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - '='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.8.7
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: tiny_tds
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: activerecord-sqlserver-adapter
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>'
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.14
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>'
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 3.0.14
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: squeel
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 0.9.0
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 0.9.0
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: rspec
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
type: :development
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
description: This adaptor exposes the Axis DB. Yeah it does!
|
96
|
+
email:
|
97
|
+
- rob@r-williams.com
|
98
|
+
- rich@stinkyink.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- .gitignore
|
104
|
+
- .rspec
|
105
|
+
- .rvmrc
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.markdown
|
109
|
+
- Rakefile
|
110
|
+
- VERSION
|
111
|
+
- axis.gemspec
|
112
|
+
- db/schema/v_customers.sql
|
113
|
+
- db/schema/v_deliveries.sql
|
114
|
+
- db/schema/v_nominal_account_transactions.sql
|
115
|
+
- db/schema/v_sales_order_lines.sql
|
116
|
+
- db/schema/v_sales_orders.sql
|
117
|
+
- db/schema/v_stock_records.sql
|
118
|
+
- lib/axis.rb
|
119
|
+
- lib/axis/base.rb
|
120
|
+
- lib/axis/config.rb
|
121
|
+
- lib/axis/document.rb
|
122
|
+
- lib/axis/models/addressee.rb
|
123
|
+
- lib/axis/models/component_record.rb
|
124
|
+
- lib/axis/models/customer.rb
|
125
|
+
- lib/axis/models/delivery.rb
|
126
|
+
- lib/axis/models/goods_on_account.rb
|
127
|
+
- lib/axis/models/goods_on_account_line.rb
|
128
|
+
- lib/axis/models/invoice.rb
|
129
|
+
- lib/axis/models/nominal_account_transaction.rb
|
130
|
+
- lib/axis/models/sales_order.rb
|
131
|
+
- lib/axis/models/sales_order_line.rb
|
132
|
+
- lib/axis/models/stock_level.rb
|
133
|
+
- lib/axis/models/stock_record.rb
|
134
|
+
- lib/axis/models/stock_record_location.rb
|
135
|
+
- lib/axis/models/supplier_price.rb
|
136
|
+
- lib/axis/version.rb
|
137
|
+
- lib/cli.rb
|
138
|
+
- pkg/axis-0.1.0.gem
|
139
|
+
- spec/axis/document_spec.rb
|
140
|
+
- spec/fixtures/ATTACH/Documents/INV/123456_0_20110101_163350_2C16B3CB_P.pdf
|
141
|
+
- spec/fixtures/ATTACH/Documents/INV/123456_0_20120101_163350_2C16B3CB_P.pdf
|
142
|
+
- spec/fixtures/ATTACH/Documents/INV/123456_0_20121002_163350_2C16B3CB_P.pdf
|
143
|
+
- spec/fixtures/ATTACH/Documents/INV/296621_0_20121001_163350_2C16B3CB_P.pdf
|
144
|
+
- spec/spec_helper.rb
|
145
|
+
homepage: ''
|
146
|
+
licenses: []
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
153
|
+
requirements:
|
154
|
+
- - ! '>='
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ! '>='
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
requirements: []
|
164
|
+
rubyforge_project: axis
|
165
|
+
rubygems_version: 1.8.24
|
166
|
+
signing_key:
|
167
|
+
specification_version: 3
|
168
|
+
summary: This adaptor exposes the Axis DB
|
169
|
+
test_files:
|
170
|
+
- spec/axis/document_spec.rb
|
171
|
+
- spec/fixtures/ATTACH/Documents/INV/123456_0_20110101_163350_2C16B3CB_P.pdf
|
172
|
+
- spec/fixtures/ATTACH/Documents/INV/123456_0_20120101_163350_2C16B3CB_P.pdf
|
173
|
+
- spec/fixtures/ATTACH/Documents/INV/123456_0_20121002_163350_2C16B3CB_P.pdf
|
174
|
+
- spec/fixtures/ATTACH/Documents/INV/296621_0_20121001_163350_2C16B3CB_P.pdf
|
175
|
+
- spec/spec_helper.rb
|