intacctrb 0.5.8 → 0.6.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/Gemfile.lock +1 -1
- data/lib/intacctrb/contact.rb +129 -0
- data/lib/intacctrb/employee.rb +10 -11
- data/lib/intacctrb/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16089eefc09b3fca5b2ba31bc760d088241f7e0c
|
4
|
+
data.tar.gz: ba01c55569d7941d235871fa8eba8ff5bd654908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc67acebb2067b80fb9e1bcf06242bfe1fc747dacb83f4ff46d44b10ff8a61be8dfd1ab2974c388ca8a521c09207fd0e1fb77f061549d978ab3e99d105193dd1
|
7
|
+
data.tar.gz: 80c3600d0e56bde8fc3dd9b842c0bee11332e190031f6d17622418ec5ca27d3920c2aa54cc4f997976ddb66c31c7030931a9b179186a75a29201ad2878d25733
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,129 @@
|
|
1
|
+
module IntacctRB
|
2
|
+
class Contact < IntacctRB::Base
|
3
|
+
def create
|
4
|
+
send_xml('create') do |xml|
|
5
|
+
xml.function(controlid: "1") {
|
6
|
+
xml.send("create") {
|
7
|
+
contact_xml(xml)
|
8
|
+
}
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
successful?
|
13
|
+
end
|
14
|
+
|
15
|
+
def get(options = {})
|
16
|
+
# return false unless object.intacct_id.present?
|
17
|
+
|
18
|
+
options[:fields] = [
|
19
|
+
:contactid,
|
20
|
+
:contactname
|
21
|
+
] if options[:fields].nil?
|
22
|
+
|
23
|
+
send_xml('get') do |xml|
|
24
|
+
xml.function(controlid: "f4") {
|
25
|
+
xml.read {
|
26
|
+
xml.object 'contact'
|
27
|
+
xml.keys object.try(:intacct_id) || options[:intacct_id]
|
28
|
+
xml.fields '*'
|
29
|
+
}
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
if successful?
|
34
|
+
@data = OpenStruct.new({
|
35
|
+
id: response.at("//contact/RECORDNO").content,
|
36
|
+
name: response.at("//contact/PERSONALINFO/CONTACTNAME").content
|
37
|
+
})
|
38
|
+
end
|
39
|
+
|
40
|
+
successful?
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_list *fields
|
44
|
+
#return false unless object.intacct_id.present?
|
45
|
+
|
46
|
+
fields = [
|
47
|
+
:customerid,
|
48
|
+
:name,
|
49
|
+
:termname
|
50
|
+
] if fields.empty?
|
51
|
+
|
52
|
+
send_xml('get_list') do |xml|
|
53
|
+
xml.function(controlid: "f4") {
|
54
|
+
xml.get_list(object: "contact", maxitems: "10", showprivate:"false") {
|
55
|
+
# xml.fields {
|
56
|
+
# fields.each do |field|
|
57
|
+
# xml.field field.to_s
|
58
|
+
# end
|
59
|
+
# }
|
60
|
+
}
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# if successful?
|
65
|
+
# @data = OpenStruct.new({
|
66
|
+
# id: response.at("//customer//customerid").content,
|
67
|
+
# name: response.at("//customer//name").content,
|
68
|
+
# termname: response.at("//customer//termname").content
|
69
|
+
# })
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# successful?
|
73
|
+
puts response
|
74
|
+
end
|
75
|
+
|
76
|
+
def update updated_contact = false
|
77
|
+
@object = updated_contact if updated_contact
|
78
|
+
return false unless object.intacct_id.present?
|
79
|
+
|
80
|
+
send_xml('update') do |xml|
|
81
|
+
xml.function(controlid: "1") {
|
82
|
+
xml.update {
|
83
|
+
contact_xml(xml, true)
|
84
|
+
}
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
successful?
|
89
|
+
end
|
90
|
+
|
91
|
+
def delete
|
92
|
+
return false unless object.intacct_id.present?
|
93
|
+
|
94
|
+
@response = send_xml('delete') do |xml|
|
95
|
+
xml.function(controlid: "1") {
|
96
|
+
xml.delete_contact(contactid: intacct_id)
|
97
|
+
}
|
98
|
+
end
|
99
|
+
|
100
|
+
successful?
|
101
|
+
end
|
102
|
+
|
103
|
+
def contact_xml(xml, is_update = false)
|
104
|
+
xml.contact {
|
105
|
+
xml.recordno object.intacct_id if object.intacct_id
|
106
|
+
xml.contactname object.name unless (is_update || object.intacct_id.nil?)
|
107
|
+
xml.printas object.name
|
108
|
+
# COMPANYNAME Optional string Company name
|
109
|
+
# TAXABLE Optional boolean Taxable. Use false for No, true for Yes. (Default: true)
|
110
|
+
# TAXGROUP Optional string Contact tax group name
|
111
|
+
# PREFIX Optional string Prefix
|
112
|
+
# FIRSTNAME Optional string First name
|
113
|
+
# LASTNAME Optional string Last name
|
114
|
+
# INITIAL Optional string Middle name
|
115
|
+
# PHONE1 Optional string Primary phone number
|
116
|
+
# PHONE2 Optional string Secondary phone number
|
117
|
+
# CELLPHONE Optional string Cellular phone number
|
118
|
+
# PAGER Optional string Pager number
|
119
|
+
# FAX Optional string Fax number
|
120
|
+
# EMAIL1 Optional string Primary email address
|
121
|
+
# EMAIL2 Optional string Secondary email address
|
122
|
+
# URL1 Optional string Primary URL
|
123
|
+
# URL2 Optional string Secondary URL
|
124
|
+
# STATUS Optional string Status. Use active for Active or inactive for Inactive (Default: active)
|
125
|
+
# MAILADDRESS Optional object Mail address
|
126
|
+
}
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
data/lib/intacctrb/employee.rb
CHANGED
@@ -13,7 +13,7 @@ module IntacctRB
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def get(options = {})
|
16
|
-
# return false unless object.
|
16
|
+
# return false unless object.intacct_id.present?
|
17
17
|
|
18
18
|
options[:fields] = [
|
19
19
|
:employeeid,
|
@@ -33,7 +33,8 @@ module IntacctRB
|
|
33
33
|
if successful?
|
34
34
|
@data = OpenStruct.new({
|
35
35
|
id: response.at("//EMPLOYEE/RECORDNO").content,
|
36
|
-
name: response.at("//EMPLOYEE/PERSONALINFO/CONTACTNAME").content
|
36
|
+
name: response.at("//EMPLOYEE/PERSONALINFO/CONTACTNAME").content,
|
37
|
+
contact_id: response.at("//EMPLOYEE/CONTACTKEY").content
|
37
38
|
})
|
38
39
|
end
|
39
40
|
|
@@ -41,7 +42,7 @@ module IntacctRB
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def get_list *fields
|
44
|
-
#return false unless object.
|
45
|
+
#return false unless object.intacct_id.present?
|
45
46
|
|
46
47
|
fields = [
|
47
48
|
:customerid,
|
@@ -75,14 +76,12 @@ module IntacctRB
|
|
75
76
|
|
76
77
|
def update updated_employee = false
|
77
78
|
@object = updated_employee if updated_employee
|
78
|
-
return false unless object.
|
79
|
+
return false unless object.intacct_id.present?
|
79
80
|
|
80
81
|
send_xml('update') do |xml|
|
81
82
|
xml.function(controlid: "1") {
|
82
|
-
xml.
|
83
|
-
xml
|
84
|
-
xml.comments
|
85
|
-
xml.status "active"
|
83
|
+
xml.update {
|
84
|
+
employee_xml(xml)
|
86
85
|
}
|
87
86
|
}
|
88
87
|
end
|
@@ -91,11 +90,11 @@ module IntacctRB
|
|
91
90
|
end
|
92
91
|
|
93
92
|
def delete
|
94
|
-
return false unless object.
|
93
|
+
return false unless object.intacct_id.present?
|
95
94
|
|
96
95
|
@response = send_xml('delete') do |xml|
|
97
96
|
xml.function(controlid: "1") {
|
98
|
-
xml.delete_employee(employeeid:
|
97
|
+
xml.delete_employee(employeeid: intacct_id)
|
99
98
|
}
|
100
99
|
end
|
101
100
|
|
@@ -104,7 +103,7 @@ module IntacctRB
|
|
104
103
|
|
105
104
|
def employee_xml xml
|
106
105
|
xml.employee {
|
107
|
-
xml.
|
106
|
+
xml.recordno if object.intacct_id
|
108
107
|
xml.title object.title if object.title
|
109
108
|
xml.personalinfo {
|
110
109
|
xml.contactname object.name
|
data/lib/intacctrb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intacctrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Hale
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- lib/intacctrb/attachment.rb
|
175
175
|
- lib/intacctrb/base.rb
|
176
176
|
- lib/intacctrb/bill.rb
|
177
|
+
- lib/intacctrb/contact.rb
|
177
178
|
- lib/intacctrb/customer.rb
|
178
179
|
- lib/intacctrb/employee.rb
|
179
180
|
- lib/intacctrb/exceptions/ap_payment.rb
|