intacct_ruby 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/intacct_ruby.rb +2 -0
- data/lib/intacct_ruby/functions/create_gltransaction.rb +65 -0
- data/lib/intacct_ruby/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 632021985d5d2829f475d86b06b6ff2083d37236
|
4
|
+
data.tar.gz: c6004ebef9549a654d7a78f9ca3009a5ce749c31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69f78e6c89431789dba034677f75a2d8153a35f150f5aa0eb31ab35ebcd9b37b1a9eac7feb518fe97520d0974536329a5af146a0e8a501453af1ec2fc284f0dc
|
7
|
+
data.tar.gz: 0922d6201630d88cd7d7ad51c452b3bc7f30a67828d0bcdc308c08dde05375095ff7f3a67433c014236a0bfcb5b1ea6ee10a67f47e531834b70d3e4178700901
|
data/lib/intacct_ruby.rb
CHANGED
@@ -0,0 +1,65 @@
|
|
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 CreateGLTransaction < BaseFunction
|
8
|
+
include DateHelper
|
9
|
+
|
10
|
+
def initialize(attrs = {})
|
11
|
+
super "create_gltransaction (#{attrs[:description]} #{timestamp})",
|
12
|
+
attrs
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_xml
|
16
|
+
super do |xml|
|
17
|
+
xml.create_gltransaction do
|
18
|
+
xml << extract_from_attrs(@attrs, :journalid)
|
19
|
+
xml << date_params(:datecreated, @attrs[:datecreated])
|
20
|
+
xml << extract_from_attrs(@attrs, :description)
|
21
|
+
|
22
|
+
xml.gltransactionentries do
|
23
|
+
xml << gltransactionentry_params(@attrs[:gltransactionentries])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
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)
|
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
|
+
end
|
64
|
+
end
|
65
|
+
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.0
|
4
|
+
version: 1.1.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-
|
11
|
+
date: 2017-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- lib/intacct_ruby/functions/create_aradjustment.rb
|
155
155
|
- lib/intacct_ruby/functions/create_customer.rb
|
156
156
|
- lib/intacct_ruby/functions/create_employee.rb
|
157
|
+
- lib/intacct_ruby/functions/create_gltransaction.rb
|
157
158
|
- lib/intacct_ruby/functions/create_item.rb
|
158
159
|
- lib/intacct_ruby/functions/create_location.rb
|
159
160
|
- lib/intacct_ruby/functions/create_project.rb
|