You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 3, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+91-15Lines changed: 91 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Unlike the other Gems out in the Rubyverse, this library supports one of the Int
12
12
13
13
In an ERP system like Intacct, you'll probably want to perform multiple actions at once, like debiting one account and crediting another, or creating several associated records simulatenously. The more calls you make, the longer it will take to see a response. That's just a fact. But if you can bundle all of those actions together into a single call, you lower the load on both your system and Intacct's servers and guarantee yourself a quicker response. Intacct's entire API is built around this idea, and `IntacctRuby` translates that philosophy into Ruby.
14
14
15
-
### How Do It Do?
15
+
### Putting Gem to Use
16
16
17
17
Let's say you want to create a project and a customer associated with that project simultaneously. The Intacct API would tell you to create a call with a `<create><CUSTOMER>` function followed by a `<create><PROJECT>` function. So let's do it!
18
18
@@ -21,27 +21,29 @@ Let's say you want to create a project and a customer associated with that proje
21
21
# for more information.
22
22
request =IntacctRuby::Request.new(REQUEST_OPTS)
23
23
24
-
request.create :customer, {
25
-
customerid:'1',
26
-
first_name:'Han',
27
-
last_name:'Solo',
28
-
type:'Person',
29
-
email1:'han@solo.com',
30
-
status:'active'
24
+
request.create :CUSTOMER, {
25
+
CUSTOMERID:'1',
26
+
FIRST_NAME:'Han',
27
+
LAST_NAME:'Solo',
28
+
TYPE:'Person',
29
+
EMAIL1:'han@solo.com',
30
+
STATUS:'active'
31
31
}
32
32
33
-
request.create :project, {
34
-
projectid:'1',
35
-
name:'Get Chewie a Haircut',
36
-
projectcategory:'Improve Wookie Hygene',
37
-
customerid:'1',
38
-
shampoo:'true', # a custom field
39
-
blowdry:'false'# a custom field
33
+
request.create :PROJECT, {
34
+
PROJECTID:'1',
35
+
NAME:'Get Chewie a Haircut',
36
+
PROJECTCATEGORY:'Improve Wookie Hygene',
37
+
CUSTOMERID:'1',
38
+
SHAMPOO:'true', # a custom field
39
+
BLOWDRY:'false'# a custom field
40
40
}
41
41
42
42
request.send
43
43
```
44
44
45
+
**Note:** Here `:CUSTOMER` and `:PROJECT` are object-types which are tagged just after the function tag `create` and are case-sensitive along with the extra-parameters(CUSTOMERID, FIRST_NAME ..)
46
+
45
47
This will fire off a request that looks something like this:
46
48
47
49
```xml
@@ -80,6 +82,80 @@ This will fire off a request that looks something like this:
80
82
</request>
81
83
```
82
84
85
+
### Read Requests
86
+
87
+
The read requests follow a slightly different pattern. The object-type is mentioned inside the object tag as seen here [Intacct List Vendors](https://developer.intacct.com/api/accounts-payable/vendors/#list-vendors). The following code will read all vendor objects.
88
+
89
+
```ruby
90
+
request =IntacctRuby::Request.new(REQUEST_OPTS)
91
+
92
+
# Object-Type VENDOR is sent through extra-parameters and not as the first argument.
93
+
request.readByQuery nil, {
94
+
object:'VENDOR',
95
+
query:'',
96
+
fields:'*',
97
+
pagesize:100
98
+
}
99
+
100
+
request.send
101
+
```
102
+
103
+
**Note:** Clean up the query argument before using it in readByQuery function as mentioned here [Intacct Illegal characters in XML](https://developer.intacct.com/web-services/queries/#illegal-characters-in-xml).
104
+
So, something like `query: "BATCH_DATE > '02/14/2018'"` should be `query: "BATCH_DATE > '02/14/2018'"`
105
+
106
+
This will fire off a request that looks something like this:
Similarly, for pagination use the `readMore` function as mentioned here [Intacct Paginate Results](https://developer.intacct.com/web-services/queries/#paginate-results)
129
+
130
+
```ruby
131
+
request =IntacctRuby::Request.new(REQUEST_OPTS)
132
+
133
+
request.readMore nil, {
134
+
resultId:'7765623332WU1hh8CoA4QAAHxI9i8AAAAA5'
135
+
}
136
+
137
+
request.send
138
+
```
139
+
140
+
This will fire off a request that looks something like this:
If there are function errors (e.g. you omitted a required field) you'll see an error on response. Same if you see an internal server error, or any error outside of the 2xx range.
0 commit comments