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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a15af76324c72f202159e4ff3dc6bec00f1d85b8
4
- data.tar.gz: d3b56f79c401c63185ac17ca972a1b4cf0e1d696
3
+ metadata.gz: 632021985d5d2829f475d86b06b6ff2083d37236
4
+ data.tar.gz: c6004ebef9549a654d7a78f9ca3009a5ce749c31
5
5
  SHA512:
6
- metadata.gz: 36c444b116e068d29767ac540fd8dda827cbb7b0a5019afd3dd894758f1f46a8a3e68b3cead14cfed3499889f81e7edffd4e66da67fd12fc20ad4c9c85f58cf0
7
- data.tar.gz: bb536bd8ebc724e0e42960e1846df6633f7135da89b0c3f00a3ce22acf23dae93ce6936c7b00759c0fd4c7d150813770d4e447963c5c9889922518a789282636
6
+ metadata.gz: 69f78e6c89431789dba034677f75a2d8153a35f150f5aa0eb31ab35ebcd9b37b1a9eac7feb518fe97520d0974536329a5af146a0e8a501453af1ec2fc284f0dc
7
+ data.tar.gz: 0922d6201630d88cd7d7ad51c452b3bc7f30a67828d0bcdc308c08dde05375095ff7f3a67433c014236a0bfcb5b1ea6ee10a67f47e531834b70d3e4178700901
data/lib/intacct_ruby.rb CHANGED
@@ -22,3 +22,5 @@ require 'intacct_ruby/functions/create_item'
22
22
  require 'intacct_ruby/functions/update_item'
23
23
 
24
24
  require 'intacct_ruby/functions/create_aradjustment'
25
+
26
+ require 'intacct_ruby/functions/create_gltransaction'
@@ -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
@@ -1,3 +1,3 @@
1
1
  module IntacctRuby
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
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.1
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-04-18 00:00:00.000000000 Z
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