Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/quickbooks/model/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Invoice < BaseModel

#== Constants
REST_RESOURCE = 'invoice'
MINORVERSION = 1
XML_COLLECTION_NODE = "Invoice"
XML_NODE = "Invoice"
EMAIL_STATUS_NEED_TO_SEND = 'NeedToSend'
Expand Down
10 changes: 7 additions & 3 deletions lib/quickbooks/model/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ def parse_row(row_node)
row_node.elements.map.with_index do |el, i|
value = el.attr('value')

next nil if value.blank?
next value if value.to_s.match(/^\d+$|^\d+.\d+$|^-\d+|^-\d+.\d+$|^.\d+$/).nil?
BigDecimal(value)
if i.zero? # Return the first column as a string, its the label.
value
elsif value.blank?
nil
else
BigDecimal(value)
end
end
end

Expand Down
1 change: 1 addition & 0 deletions lib/quickbooks/model/sales_item_line_detail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class SalesItemLineDetail < BaseModel
xml_accessor :quantity, :from => 'Qty', :as => BigDecimal, :to_xml => Proc.new { |val| val.to_f }
xml_accessor :tax_code_ref, :from => 'TaxCodeRef', :as => BaseReference
xml_accessor :service_date, :from => 'ServiceDate', :as => Date
xml_accessor :tax_inclusive_amount, :from => 'TaxInclusiveAmt', :as => BigDecimal, :to_xml => Proc.new { |val| val.to_f }

reference_setters :item_ref, :class_ref, :price_level_ref, :tax_code_ref
end
Expand Down
2 changes: 1 addition & 1 deletion lib/quickbooks/service/base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def check_response(response, options = {})
when 429
message = parse_intuit_error[:message]
raise Quickbooks::TooManyRequests, message
when 502, 503, 504
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the removal of the 502 code here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These updates came from the 0.6.2 version of the gem. I merged them in from the gem as I was surprised that they were not in the github repository. Are you the only owner of the gem, as it seems to have been updated independently of the github repository?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha. Yep, my bad. After cutting 0.6.2 back in May I forgot to push my change to version.rb; which I just did. However, it was only version.rb and HISTORY.md that didnt get pushed. All other files (such as lib/quickbooks/service/base_service.rb and the addition of the 502 status check have been in the repo since May)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These have now been reverted and can be ignored. I was confused by the status of the gem as it didn't match the repo. Do I need to do anything more for this pull request?

when 503, 504
raise Quickbooks::ServiceUnavailable
else
raise "HTTP Error Code: #{status}, Msg: #{response.plain_body}"
Expand Down
15 changes: 15 additions & 0 deletions lib/quickbooks/service/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ def delete(invoice)
delete_by_query_string(invoice)
end

def url_for_resource(resource)
url = super(resource)
"#{url}?minorversion=#{Quickbooks::Model::Invoice::MINORVERSION}"
end

def fetch_by_id(id, params = {})
url = "#{url_for_base}/invoice/#{id}?minorversion=#{Quickbooks::Model::Invoice::MINORVERSION}"
fetch_object(model, url, params)
end

def url_for_query(query = nil, start_position = 1, max_results = 20, options = {})
url = super(query, start_position, max_results, options)
"#{url}&minorversion=#{Quickbooks::Model::Invoice::MINORVERSION}"
end

def send(invoice, email_address=nil)
query = email_address.present? ? "?sendTo=#{email_address}" : ""
url = "#{url_for_resource(model::REST_RESOURCE)}/#{invoice.id}/send#{query}"
Expand Down
2 changes: 1 addition & 1 deletion lib/quickbooks/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Quickbooks

VERSION = "0.6.1"
VERSION = "0.6.2"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to bump this yourself. I will do it pre-release


end