intacct_ruby 1.2.0 → 1.4.0
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/lib/intacct_ruby.rb +1 -0
- data/lib/intacct_ruby/functions/create_gltransaction.rb +3 -40
- data/lib/intacct_ruby/functions/create_statgltransaction.rb +28 -0
- data/lib/intacct_ruby/functions/gltransaction_base_function.rb +64 -0
- data/lib/intacct_ruby/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b94aa6999b99890aa710906d66b2c9762cf55d16
|
4
|
+
data.tar.gz: 1b5c27eacb8d13683f6235edaff522c38416bcd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7366a547e048ca34d94fa037aabf63bfd5efd929e5eb6296415e09cb7fa18ad4510bd9904359999d6d67edf2ffe426b67d89e7ab6f10f692b12bf61ab2d6cc5f
|
7
|
+
data.tar.gz: 3a4effd39cf99530e4feda80b23e0063b2796d44e7cf81620914f4e15f60b85d33edcad92821656eed15157e1804f58c4380b1f60b051a97830d4d55f06e8fcc
|
data/lib/intacct_ruby.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'intacct_ruby/functions/
|
1
|
+
require 'intacct_ruby/functions/gltransaction_base_function'
|
2
2
|
require 'intacct_ruby/helpers/date_helper'
|
3
3
|
|
4
4
|
module IntacctRuby
|
5
5
|
module Functions
|
6
6
|
# creates gltransaction instance in Intacct
|
7
|
-
class CreateGLTransaction <
|
7
|
+
class CreateGLTransaction < GLTransactionBaseFunction
|
8
8
|
include DateHelper
|
9
9
|
|
10
10
|
def initialize(attrs = {})
|
@@ -15,9 +15,7 @@ module IntacctRuby
|
|
15
15
|
def to_xml
|
16
16
|
super do |xml|
|
17
17
|
xml.create_gltransaction do
|
18
|
-
xml <<
|
19
|
-
xml << date_params(:datecreated, @attrs[:datecreated])
|
20
|
-
xml << extract_from_attrs(@attrs, :description)
|
18
|
+
xml << gltransaction_header_params(@attrs)
|
21
19
|
|
22
20
|
xml.gltransactionentries do
|
23
21
|
xml << gltransactionentry_params(@attrs[:gltransactionentries])
|
@@ -25,41 +23,6 @@ module IntacctRuby
|
|
25
23
|
end
|
26
24
|
end
|
27
25
|
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def gltransactionentry_params(transaction_entries)
|
32
|
-
xml = Builder::XmlMarkup.new
|
33
|
-
|
34
|
-
transaction_entries.each do |entry_attrs|
|
35
|
-
xml << gl_entry_params(entry_attrs)
|
36
|
-
end
|
37
|
-
|
38
|
-
xml.target!
|
39
|
-
end
|
40
|
-
|
41
|
-
def gl_entry_params(attrs)
|
42
|
-
xml = Builder::XmlMarkup.new
|
43
|
-
|
44
|
-
xml.glentry do
|
45
|
-
xml << extract_from_attrs(attrs, :trtype, :amount, :glaccountno)
|
46
|
-
xml << date_params(:datecreated, attrs[:datecreated])
|
47
|
-
xml << extract_from_attrs(attrs, :memo, :locationid, :customerid, :employeeid)
|
48
|
-
end
|
49
|
-
|
50
|
-
xml.target!
|
51
|
-
end
|
52
|
-
|
53
|
-
def extract_from_attrs(attributes_hash, *keys)
|
54
|
-
xml = Builder::XmlMarkup.new
|
55
|
-
|
56
|
-
keys.each do |key|
|
57
|
-
value = attributes_hash[key]
|
58
|
-
xml.tag!(key) { xml << value.to_s } if value
|
59
|
-
end
|
60
|
-
|
61
|
-
xml.target!
|
62
|
-
end
|
63
26
|
end
|
64
27
|
end
|
65
28
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'intacct_ruby/functions/gltransaction_base_function'
|
2
|
+
require 'intacct_ruby/helpers/date_helper'
|
3
|
+
|
4
|
+
module IntacctRuby
|
5
|
+
module Functions
|
6
|
+
# creates gltransaction instance in Intacct
|
7
|
+
class CreateStatGLTransaction < GLTransactionBaseFunction
|
8
|
+
include DateHelper
|
9
|
+
|
10
|
+
def initialize(attrs = {})
|
11
|
+
super "create_statgltransaction (#{attrs[:description]} #{timestamp})",
|
12
|
+
attrs
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_xml
|
16
|
+
super do |xml|
|
17
|
+
xml.create_statgltransaction do
|
18
|
+
xml << gltransaction_header_params(@attrs)
|
19
|
+
|
20
|
+
xml.statgltransactionentries do
|
21
|
+
xml << gltransactionentry_params(@attrs[:statgltransactionentries])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'intacct_ruby/functions/base_function'
|
2
|
+
require 'intacct_ruby/helpers/date_helper'
|
3
|
+
|
4
|
+
module IntacctRuby
|
5
|
+
module Functions
|
6
|
+
# creates gltransaction instance in Intacct
|
7
|
+
class GLTransactionBaseFunction < BaseFunction
|
8
|
+
include DateHelper
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def gltransaction_header_params(attributes)
|
13
|
+
xml = Builder::XmlMarkup.new
|
14
|
+
|
15
|
+
xml << extract_from_attrs(attributes, :journalid)
|
16
|
+
xml << date_params(:datecreated, attributes[:datecreated])
|
17
|
+
xml << extract_from_attrs(attributes, :description)
|
18
|
+
|
19
|
+
xml.target!
|
20
|
+
end
|
21
|
+
|
22
|
+
def gltransactionentry_params(transaction_entries)
|
23
|
+
xml = Builder::XmlMarkup.new
|
24
|
+
|
25
|
+
transaction_entries.each do |entry_attrs|
|
26
|
+
xml << glentry_params(entry_attrs)
|
27
|
+
end
|
28
|
+
|
29
|
+
xml.target!
|
30
|
+
end
|
31
|
+
|
32
|
+
def glentry_params(attrs)
|
33
|
+
xml = Builder::XmlMarkup.new
|
34
|
+
|
35
|
+
xml.glentry do
|
36
|
+
xml << extract_from_attrs(attrs, :trtype, :amount, :glaccountno)
|
37
|
+
xml << date_params(:datecreated, attrs[:datecreated])
|
38
|
+
xml << extract_from_attrs(
|
39
|
+
attrs,
|
40
|
+
:memo,
|
41
|
+
:locationid,
|
42
|
+
:customerid,
|
43
|
+
:employeeid,
|
44
|
+
:projectid,
|
45
|
+
:itemid
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
xml.target!
|
50
|
+
end
|
51
|
+
|
52
|
+
def extract_from_attrs(attributes_hash, *keys)
|
53
|
+
xml = Builder::XmlMarkup.new
|
54
|
+
|
55
|
+
keys.each do |key|
|
56
|
+
value = attributes_hash[key]
|
57
|
+
xml.tag!(key) { xml << value.to_s } if value
|
58
|
+
end
|
59
|
+
|
60
|
+
xml.target!
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/intacct_ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intacct_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Zornow
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -158,8 +158,10 @@ files:
|
|
158
158
|
- lib/intacct_ruby/functions/create_item.rb
|
159
159
|
- lib/intacct_ruby/functions/create_location.rb
|
160
160
|
- lib/intacct_ruby/functions/create_project.rb
|
161
|
+
- lib/intacct_ruby/functions/create_statgltransaction.rb
|
161
162
|
- lib/intacct_ruby/functions/customer_base_function.rb
|
162
163
|
- lib/intacct_ruby/functions/employee_base_function.rb
|
164
|
+
- lib/intacct_ruby/functions/gltransaction_base_function.rb
|
163
165
|
- lib/intacct_ruby/functions/item_base_function.rb
|
164
166
|
- lib/intacct_ruby/functions/location_base_function.rb
|
165
167
|
- lib/intacct_ruby/functions/project_base_function.rb
|