intacctrb 0.5.3 → 0.5.4

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: 3aeff457a86780e57e8ce95dd16e9fa1a0ff741d
4
- data.tar.gz: a367cc0c01ce8d81bbbe9a20e6450f253ce4afdd
3
+ metadata.gz: 74d1df580ccbd861844fb5039c76e8c491ff05ab
4
+ data.tar.gz: 29e2abe2a73f4e75ca8ee890bfb1a1b19d893b36
5
5
  SHA512:
6
- metadata.gz: ba1db8661fae094d07f29ee2b86ec5637f82d63726769fc59052ca243c7563e6c705c92fc6e6719908f1e987a6af5a8d65e026dd7b8c8b01f61804d9f874cb7c
7
- data.tar.gz: 510e4d34c7bbd2ef78061aa9acdb34448b55df13a2dc4355c6f41da296c444010448c1753134d3ca93940902175c57d03bd1dd6ea3f3c5fbab562f388d361f25
6
+ metadata.gz: 5553c35745e1dc31e1b6130cf0bfac1e126dfe56d8d6c40c52a690d7bec0beb8d6b7a91cc8a569ecffa44fb09d543346aff88fa76382d5b972e1b0eea8cee293
7
+ data.tar.gz: aa273537c5abf64a5b3985e95d9093b14b0bac8d9b321db7afd8fcc08a4e552ba0dd527c6a42c7d814ff6fe22cc0df3266b8c427e53832d3c13416412cba7e89
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- intacctrb (0.5.3)
4
+ intacctrb (0.5.4)
5
5
  hooks
6
6
  nokogiri
7
7
 
@@ -5,6 +5,7 @@ require 'hooks'
5
5
  require 'ostruct'
6
6
  require "intacctrb/base"
7
7
  require "intacctrb/customer"
8
+ require "intacctrb/employee"
8
9
  require "intacctrb/journal_entry"
9
10
  require "intacctrb/vendor"
10
11
  require "intacctrb/invoice"
@@ -0,0 +1,127 @@
1
+ module IntacctRB
2
+ class Employee < IntacctRB::Base
3
+ def create
4
+ send_xml('create') do |xml|
5
+ xml.function(controlid: "1") {
6
+ xml.send("create_employee") {
7
+ employee_xml(xml)
8
+ }
9
+ }
10
+ end
11
+
12
+ successful?
13
+ end
14
+
15
+ def get *fields
16
+ #return false unless object.intacct_system_id.present?
17
+
18
+ fields = [
19
+ :employeeid,
20
+ :personalinfo
21
+ ] if fields.empty?
22
+
23
+ send_xml('get') do |xml|
24
+ xml.function(controlid: "f4") {
25
+ xml.get(object: "employee", key: "intacct_system_id") {
26
+ xml.fields {
27
+ fields.each do |field|
28
+ xml.field field.to_s
29
+ end
30
+ }
31
+ }
32
+ }
33
+ end
34
+
35
+ if successful?
36
+ @data = OpenStruct.new({
37
+ id: response.at("//employee//employeeid").content,
38
+ name: response.at("//employee//personalinfo//contactname").content
39
+ })
40
+ end
41
+
42
+ successful?
43
+ end
44
+
45
+ def get_list *fields
46
+ #return false unless object.intacct_system_id.present?
47
+
48
+ fields = [
49
+ :customerid,
50
+ :name,
51
+ :termname
52
+ ] if fields.empty?
53
+
54
+ send_xml('get_list') do |xml|
55
+ xml.function(controlid: "f4") {
56
+ xml.get_list(object: "employee", maxitems: "10", showprivate:"false") {
57
+ # xml.fields {
58
+ # fields.each do |field|
59
+ # xml.field field.to_s
60
+ # end
61
+ # }
62
+ }
63
+ }
64
+ end
65
+
66
+ # if successful?
67
+ # @data = OpenStruct.new({
68
+ # id: response.at("//customer//customerid").content,
69
+ # name: response.at("//customer//name").content,
70
+ # termname: response.at("//customer//termname").content
71
+ # })
72
+ # end
73
+ #
74
+ # successful?
75
+ puts response
76
+ end
77
+
78
+ def update updated_employee = false
79
+ @object = updated_employee if updated_employee
80
+ return false unless object.intacct_system_id.present?
81
+
82
+ send_xml('update') do |xml|
83
+ xml.function(controlid: "1") {
84
+ xml.update_employee(employeeid: intacct_system_id) {
85
+ xml.name object.name
86
+ xml.comments
87
+ xml.status "active"
88
+ }
89
+ }
90
+ end
91
+
92
+ successful?
93
+ end
94
+
95
+ def delete
96
+ return false unless object.intacct_system_id.present?
97
+
98
+ @response = send_xml('delete') do |xml|
99
+ xml.function(controlid: "1") {
100
+ xml.delete_customer(employeeid: intacct_system_id)
101
+ }
102
+ end
103
+
104
+ successful?
105
+ end
106
+
107
+ def employee_xml xml
108
+ xml.employeeid object.intacct_id if object.intacct_id
109
+ xml.title object.title if object.title
110
+ xml.personalinfo {
111
+ xml.contactname object.name
112
+ }
113
+ xml.locationid object.location_id if object.location_id
114
+ xml.departmentid object.departmentid if object.department_id
115
+ xml.classid object.classid if object.department_id
116
+ xml.supervisorid object.supervisorid if object.department_id
117
+ xml.birthdate date_string(object.birthdate) if object.birthdate
118
+ xml.startdate date_string(object.startdate) if object.startdate
119
+ xml.enddate date_string(object.enddate) if object.enddate
120
+ xml.terminationtype object.terminationtype if object.terminationtype
121
+ xml.employeetype object.employeetype if object.employeetype
122
+ xml.gender object.gender if object.gender
123
+ xml.status object.status if object.status
124
+ xml.currency object.currency if object.currency
125
+ end
126
+ end
127
+ end
@@ -1,3 +1,3 @@
1
1
  module IntacctRB
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intacctrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Hale
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2018-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -175,6 +175,7 @@ files:
175
175
  - lib/intacctrb/base.rb
176
176
  - lib/intacctrb/bill.rb
177
177
  - lib/intacctrb/customer.rb
178
+ - lib/intacctrb/employee.rb
178
179
  - lib/intacctrb/exceptions/ap_payment.rb
179
180
  - lib/intacctrb/exceptions/attachment.rb
180
181
  - lib/intacctrb/exceptions/base.rb