quickbooks-ruby 2.0.3 → 2.0.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
  SHA256:
3
- metadata.gz: 984503e5cdf57dff8779bb3e019329543063f0cc0c782375cdad4afa7b28d55c
4
- data.tar.gz: d71a71a34772c21278e1c978142a6987b247c92371ac131ef37c1767c38e4349
3
+ metadata.gz: f36b6bed0641c07ea47b8b614f35f1dc1ad7af47b75fef485b9a124c85b96fd5
4
+ data.tar.gz: 8a8da5cdd8ac745f1f6737814b3e1ffb4a0768466a7ba1c2ed5aa349009ac52b
5
5
  SHA512:
6
- metadata.gz: f59fd3a45baec15ee4909be96ce416dfc57e9fdbb3b7f2e496aa1e87610ce17f56da5efffa9e0e49c284aaeaab127e6b693ae18a541a9eaf024abca560820654
7
- data.tar.gz: 6e51e37b4a5b451895aa093e5a3470299dc2d1e877e1eeb0335e0c861a70a02e191ef0a7e674da3ddecb3b5aa21b8cd5ec9270b4eabd7991ba265a046c677ca6
6
+ metadata.gz: 8a669cfa52f77163b34a6affa904f5d8f7cb42eeaaca1d77376af6f2d325c96d327e77d04dd92ce789a431121cd0063b5394b3ae53b525ff1a8f09b308c63552
7
+ data.tar.gz: 75cd3b18a231f4d06ec5377dce4409459d0a27dd35fbe970a9ca2820433f3dbd6fdf47bf0c9d5e91e0944796257946edf13bdabef2c80841e498ea0c9adf92b2
@@ -224,7 +224,7 @@ module Quickbooks
224
224
  if metadata
225
225
  standalone_prefix = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
226
226
  meta_data_xml = "#{standalone_prefix}\n#{metadata.to_xml_ns.to_s}"
227
- param_part = UploadIO.new(StringIO.new(meta_data_xml), "application/xml")
227
+ param_part = Faraday::UploadIO.new(StringIO.new(meta_data_xml), "application/xml")
228
228
  body['file_metadata_0'] = param_part
229
229
  end
230
230
 
@@ -369,7 +369,7 @@ module Quickbooks
369
369
  body.each do |k,v|
370
370
  messages << 'BODY PART:'
371
371
  val_content = v.inspect
372
- if v.is_a?(UploadIO)
372
+ if v.is_a?(Faraday::UploadIO)
373
373
  if v.content_type == 'application/xml'
374
374
  if v.io.is_a?(StringIO)
375
375
  val_content = log_xml(v.io.string)
@@ -411,10 +411,12 @@ module Quickbooks
411
411
 
412
412
  def parse_and_raise_exception(options = {})
413
413
  err = parse_intuit_error
414
- ex = Quickbooks::IntuitRequestException.new("#{err[:message]}:\n\t#{err[:detail]}")
414
+ element_msg = err[:element] ? "#{err[:element]}: " : ""
415
+ ex = Quickbooks::IntuitRequestException.new("#{element_msg}#{err[:message]}:\n\t#{err[:detail]}")
415
416
  ex.code = err[:code]
416
417
  ex.detail = err[:detail]
417
418
  ex.type = err[:type]
419
+ ex.element = err[:element] if err[:element]
418
420
  if is_json?
419
421
  ex.request_json = options[:request]
420
422
  else
@@ -448,7 +450,7 @@ module Quickbooks
448
450
  end
449
451
  element_attr = error_element.attributes['element']
450
452
  if element_attr
451
- error[:element] = code_attr.value
453
+ error[:element] = element_attr.try(:value)
452
454
  end
453
455
  error[:message] = error_element.xpath("//xmlns:Message").text
454
456
  error[:detail] = error_element.xpath("//xmlns:Detail").text
@@ -9,7 +9,7 @@ module Quickbooks
9
9
  # attachable: Quickbooks::Model::Attachable meta-data details, can be null
10
10
  def upload(path_to_file, mime_type, attachable = nil)
11
11
  url = url_for_resource("upload")
12
- uploadIO = class_for_io.new(path_to_file, mime_type)
12
+ uploadIO = Faraday::UploadIO.new(path_to_file, mime_type)
13
13
  response = do_http_file_upload(uploadIO, url, attachable)
14
14
  prefix = "AttachableResponse/xmlns:Attachable"
15
15
  if response.code.to_i == 200
@@ -19,10 +19,6 @@ module Quickbooks
19
19
  end
20
20
  end
21
21
 
22
- def class_for_io
23
- oauth.is_a?(OAuth2::AccessToken) ? Faraday::UploadIO : UploadIO
24
- end
25
-
26
22
  def download(uploadId)
27
23
  url = url_for_resource("download/#{uploadId}")
28
24
  do_http_get(url, {}, headers)
@@ -1,5 +1,5 @@
1
1
  module Quickbooks
2
2
 
3
- VERSION = "2.0.3"
3
+ VERSION = "2.0.4"
4
4
 
5
5
  end
@@ -273,7 +273,7 @@ module Quickbooks
273
273
  class UnsupportedOperation < Error; end
274
274
 
275
275
  class IntuitRequestException < Error
276
- attr_accessor :message, :code, :detail, :type, :intuit_tid, :request_xml, :request_json
276
+ attr_accessor :message, :code, :detail, :element, :type, :intuit_tid, :request_xml, :request_json
277
277
 
278
278
  def initialize(msg)
279
279
  self.message = msg
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickbooks-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Caughlan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-12 00:00:00.000000000 Z
11
+ date: 2024-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -115,6 +115,9 @@ dependencies:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.0'
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 1.0.4
118
121
  type: :runtime
119
122
  prerelease: false
120
123
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,18 +125,21 @@ dependencies:
122
125
  - - "~>"
123
126
  - !ruby/object:Gem::Version
124
127
  version: '1.0'
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: 1.0.4
125
131
  - !ruby/object:Gem::Dependency
126
132
  name: faraday-gzip
127
133
  requirement: !ruby/object:Gem::Requirement
128
134
  requirements:
129
- - - "~>"
135
+ - - ">="
130
136
  - !ruby/object:Gem::Version
131
137
  version: '1.0'
132
138
  type: :runtime
133
139
  prerelease: false
134
140
  version_requirements: !ruby/object:Gem::Requirement
135
141
  requirements:
136
- - - "~>"
142
+ - - ">="
137
143
  - !ruby/object:Gem::Version
138
144
  version: '1.0'
139
145
  - !ruby/object:Gem::Dependency
@@ -417,7 +423,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
417
423
  - !ruby/object:Gem::Version
418
424
  version: '0'
419
425
  requirements: []
420
- rubygems_version: 3.0.3.1
426
+ rubygems_version: 3.1.6
421
427
  signing_key:
422
428
  specification_version: 4
423
429
  summary: REST API to Quickbooks Online