intacct_ruby_team 1.7.1

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.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +179 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/intacct_ruby.gemspec +36 -0
  14. data/lib/intacct_ruby.rb +27 -0
  15. data/lib/intacct_ruby/api.rb +31 -0
  16. data/lib/intacct_ruby/exceptions/empty_request_exception.rb +5 -0
  17. data/lib/intacct_ruby/exceptions/function_failure_exception.rb +5 -0
  18. data/lib/intacct_ruby/exceptions/insufficient_credentials_exception.rb +5 -0
  19. data/lib/intacct_ruby/exceptions/unknown_function_type.rb +5 -0
  20. data/lib/intacct_ruby/function.rb +92 -0
  21. data/lib/intacct_ruby/functions/base_function.rb +48 -0
  22. data/lib/intacct_ruby/functions/create_aradjustment.rb +48 -0
  23. data/lib/intacct_ruby/functions/create_customer.rb +23 -0
  24. data/lib/intacct_ruby/functions/create_employee.rb +21 -0
  25. data/lib/intacct_ruby/functions/create_gltransaction.rb +28 -0
  26. data/lib/intacct_ruby/functions/create_item.rb +21 -0
  27. data/lib/intacct_ruby/functions/create_location.rb +21 -0
  28. data/lib/intacct_ruby/functions/create_project.rb +20 -0
  29. data/lib/intacct_ruby/functions/create_statgltransaction.rb +28 -0
  30. data/lib/intacct_ruby/functions/customer_base_function.rb +27 -0
  31. data/lib/intacct_ruby/functions/employee_base_function.rb +36 -0
  32. data/lib/intacct_ruby/functions/gltransaction_base_function.rb +64 -0
  33. data/lib/intacct_ruby/functions/item_base_function.rb +29 -0
  34. data/lib/intacct_ruby/functions/location_base_function.rb +24 -0
  35. data/lib/intacct_ruby/functions/project_base_function.rb +22 -0
  36. data/lib/intacct_ruby/functions/update_customer.rb +22 -0
  37. data/lib/intacct_ruby/functions/update_employee.rb +20 -0
  38. data/lib/intacct_ruby/functions/update_item.rb +20 -0
  39. data/lib/intacct_ruby/functions/update_location.rb +20 -0
  40. data/lib/intacct_ruby/functions/update_project.rb +20 -0
  41. data/lib/intacct_ruby/helpers/contacts_helper.rb +32 -0
  42. data/lib/intacct_ruby/helpers/date_helper.rb +22 -0
  43. data/lib/intacct_ruby/request.rb +138 -0
  44. data/lib/intacct_ruby/response.rb +43 -0
  45. data/lib/intacct_ruby/version.rb +3 -0
  46. metadata +205 -0
@@ -0,0 +1,43 @@
1
+ require 'nokogiri'
2
+ require 'intacct_ruby/exceptions/function_failure_exception'
3
+
4
+ module IntacctRuby
5
+ # Wraps an XML API response, throwing an exception if the call was unsucessful
6
+ #
7
+ # This class *can* be instantiated on its own, but only in cases where the
8
+ # contents of the response (e.g. generated keys, query results) aren't
9
+ # important.
10
+ #
11
+ # If, for example, a key returned needs to be extracted from the response,
12
+ # extend this class and add methods that access whatever data is required.
13
+ class Response
14
+ attr_reader :response_body
15
+
16
+ def initialize(xml_response)
17
+ @response_body = Nokogiri::XML(xml_response.body)
18
+
19
+ # raises an error unless the response is in the 2xx range.
20
+ xml_response.value
21
+
22
+ # in case the response is a success, but one of the included functions
23
+ # failed and the transaction was rolled back
24
+ raise_function_errors unless transaction_successful?
25
+ end
26
+
27
+ def function_errors
28
+ @function_errors ||= @response_body.xpath('//error/description2')
29
+ .map(&:text)
30
+ end
31
+
32
+ private
33
+
34
+ def transaction_successful?
35
+ function_errors.none?
36
+ end
37
+
38
+ def raise_function_errors
39
+ raise Exceptions::FunctionFailureException,
40
+ function_errors.join("\n")
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,3 @@
1
+ module IntacctRuby
2
+ VERSION = '1.7.1'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,205 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: intacct_ruby_team
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.7.1
5
+ platform: ruby
6
+ authors:
7
+ - Erich L Timkar
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-10-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 1.6.8
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '1.6'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 1.6.8
75
+ - !ruby/object:Gem::Dependency
76
+ name: mocha
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 0.13.3
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: 0.13.3
89
+ - !ruby/object:Gem::Dependency
90
+ name: pry-byebug
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '3.4'
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 3.4.2
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: '3.4'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 3.4.2
109
+ - !ruby/object:Gem::Dependency
110
+ name: builder
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '3.0'
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 3.0.4
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '3.0'
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 3.0.4
129
+ description: Allows for multi-function API calls, the addition of custom fields, and
130
+ more. All in an easy-to-use package!
131
+ email:
132
+ - erich@teamdriveaway.com
133
+ executables: []
134
+ extensions: []
135
+ extra_rdoc_files: []
136
+ files:
137
+ - ".gitignore"
138
+ - ".rspec"
139
+ - ".ruby-gemset"
140
+ - ".ruby-version"
141
+ - CODE_OF_CONDUCT.md
142
+ - Gemfile
143
+ - LICENSE.txt
144
+ - README.md
145
+ - Rakefile
146
+ - bin/console
147
+ - bin/setup
148
+ - intacct_ruby.gemspec
149
+ - lib/intacct_ruby.rb
150
+ - lib/intacct_ruby/api.rb
151
+ - lib/intacct_ruby/exceptions/empty_request_exception.rb
152
+ - lib/intacct_ruby/exceptions/function_failure_exception.rb
153
+ - lib/intacct_ruby/exceptions/insufficient_credentials_exception.rb
154
+ - lib/intacct_ruby/exceptions/unknown_function_type.rb
155
+ - lib/intacct_ruby/function.rb
156
+ - lib/intacct_ruby/functions/base_function.rb
157
+ - lib/intacct_ruby/functions/create_aradjustment.rb
158
+ - lib/intacct_ruby/functions/create_customer.rb
159
+ - lib/intacct_ruby/functions/create_employee.rb
160
+ - lib/intacct_ruby/functions/create_gltransaction.rb
161
+ - lib/intacct_ruby/functions/create_item.rb
162
+ - lib/intacct_ruby/functions/create_location.rb
163
+ - lib/intacct_ruby/functions/create_project.rb
164
+ - lib/intacct_ruby/functions/create_statgltransaction.rb
165
+ - lib/intacct_ruby/functions/customer_base_function.rb
166
+ - lib/intacct_ruby/functions/employee_base_function.rb
167
+ - lib/intacct_ruby/functions/gltransaction_base_function.rb
168
+ - lib/intacct_ruby/functions/item_base_function.rb
169
+ - lib/intacct_ruby/functions/location_base_function.rb
170
+ - lib/intacct_ruby/functions/project_base_function.rb
171
+ - lib/intacct_ruby/functions/update_customer.rb
172
+ - lib/intacct_ruby/functions/update_employee.rb
173
+ - lib/intacct_ruby/functions/update_item.rb
174
+ - lib/intacct_ruby/functions/update_location.rb
175
+ - lib/intacct_ruby/functions/update_project.rb
176
+ - lib/intacct_ruby/helpers/contacts_helper.rb
177
+ - lib/intacct_ruby/helpers/date_helper.rb
178
+ - lib/intacct_ruby/request.rb
179
+ - lib/intacct_ruby/response.rb
180
+ - lib/intacct_ruby/version.rb
181
+ homepage: https://github.com/TeamDriveAway/intacct-ruby
182
+ licenses:
183
+ - MIT
184
+ metadata: {}
185
+ post_install_message:
186
+ rdoc_options: []
187
+ require_paths:
188
+ - lib
189
+ required_ruby_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: 2.3.0
194
+ required_rubygems_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ requirements: []
200
+ rubyforge_project:
201
+ rubygems_version: 2.6.14
202
+ signing_key:
203
+ specification_version: 4
204
+ summary: A Ruby wrapper for the Intacct API
205
+ test_files: []