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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/intacctrb.rb +1 -0
- data/lib/intacctrb/employee.rb +127 -0
- data/lib/intacctrb/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: 74d1df580ccbd861844fb5039c76e8c491ff05ab
|
4
|
+
data.tar.gz: 29e2abe2a73f4e75ca8ee890bfb1a1b19d893b36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5553c35745e1dc31e1b6130cf0bfac1e126dfe56d8d6c40c52a690d7bec0beb8d6b7a91cc8a569ecffa44fb09d543346aff88fa76382d5b972e1b0eea8cee293
|
7
|
+
data.tar.gz: aa273537c5abf64a5b3985e95d9093b14b0bac8d9b321db7afd8fcc08a4e552ba0dd527c6a42c7d814ff6fe22cc0df3266b8c427e53832d3c13416412cba7e89
|
data/Gemfile.lock
CHANGED
data/lib/intacctrb.rb
CHANGED
@@ -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
|
data/lib/intacctrb/version.rb
CHANGED
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.
|
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:
|
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
|