-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Implement Reports API #146
Comments
Awesome! Yeah if you wanted to take a stab it would be much appreciated. So I just had a quick peek at the API and it appears to only return JSON, An example output of the AgedReceivables report is here: https://gist.github.com/ruckus/747c702d7ab7f4243c69 Rather than attempt to analyze / parse the JSON (in quickbooks-ruby) I'm So basically your report classes should just handle accepting query What do you think? Thanks again! On Thu, Jul 31, 2014 at 2:52 PM, Chris Moore [email protected]
|
+1! |
@ruckus makes sense. JSON is part of stdlib now, so would it be okay to use the builtin parser? |
Oh nice, I didn't know that JSON was included in std lib. So yeah, if you want to parse it really quick and return the parsed representation than go for it! Thanks again. On Aug 11, 2014, at 2:44 PM, Chris Moore [email protected] wrote:
|
@ruckus cool. I'm planning to pair on it this week. |
@ruckus - I want to check some of my assumptions about the project:
Given this information, it seems like there should be a new layer, similar in functionality to BaseService for interacting with the Reports API. Is my understanding correct? |
Yes, looks like you have it understood correctly. In the case of Reports I'm not sure how beneficial it would be to model out Thus, if it were up to me I'd just build a BaseReportsService class (or I hope this helps! On Thu, Aug 14, 2014 at 4:58 AM, Michael Guterl [email protected]
|
One thing which isn't related to this issue. I'd like to inspect what is sent and received by this gem at as deep level as possible. This isn't that useful because it shows quite the high level information:
Is there any way to make it show the information at a deeper level? P.S. I'm aware about wireshark, though, but since I'm using WiFi with a password, wireshark shows the encrypted data, not plain . |
What do you mean by "show information at a deeper level?" Do you mean more of the HTTP information? During development I find it extremely useful to use an HTTP proxy, which you are with wireshark. And yes, the proxy app does need to support SSL decryption. I think adding a ton more debugging to quickbooks-ruby is outside the scope and I recommend to use an HTTP proxy. I use Charles Proxy: http://www.charlesproxy.com/ and I have heard good things about mitmproxy: http://mitmproxy.org/ which also supports SSL. On Aug 19, 2014, at 3:44 AM, Alex Maslakov [email protected] wrote:
|
Thanks but I can't get along with mitmproxy. What is need it just to be able to see what information quickbooks-ruby sends and receives exactly (what headers look like, body, etc...) to be able to do the same thing in Python. Quickbooks.logger doesn't show that much. |
Well there is a free trial of Charles Proxy.... If you're unsure how to point Quickbooks to a Proxy app running on your machine its just this config: $qb = OAuth::Consumer.new($consumer_key, $consumer_secret, {
:site => "https://oauth.intuit.com",
:request_token_path => "/oauth/v1/get_request_token",
:authorize_path => "/oauth/v1/get_access_token",
:access_token_path => "/oauth/v1/get_access_token",
:proxy => "http://127.0.0.1:8888"
}) Notice the However, if When I run it with: Quickbooks.log = true
Quickbooks.logger = Logger.new($stdout)
# ... call a service ... I get output like:
If the above logging is not working then feel free to submit a Pull Request with more debugging enabled. |
As for QuickBooks.log, I see this:
That's not helpful, I can't translate this in Python because what is shown is an abstraction at a high level, I need to know what the body looks like exactly in lower level. The same for the headers, but I've already found out what they should look like (I hope). |
Charles Proxy - quite useful, however. |
On Aug 19, 2014, at 11:18 AM, Alex Maslakov [email protected] wrote:
|
Hi guys any update on incorporating the Reports API? |
+1, a reports API feature would be great! |
Anything here guys? |
@johnroa not yet, but it's still on my list! If someone gets to it before me, that would be swell. |
+1! |
FYI: There is has been a WIP PR put in over here #204 |
I am wondering if anyone has gotten the code in #204 that was merged in to work. I always get an empty Collection response when I try to use the ReportService. Looking at the code, ReportService tries to parse the response xml as an collection, which expects the xml response root to be an [1]. As I query the API, and look at the examples inside the spec/fixtures directory, I'm seeing the root node is [2]. Therefore this Maybe Intuits api changed, or as mentioned in the discussion in #204 maybe people are doing something like: client.query('BalanceSheet')
xml = Nokogiri.parse(client.last_reponse_xml)
... If thats the only way to get access to the underlying report data, then I don't understand the purpose of Models::Report or code like quickbooks-ruby/lib/quickbooks/service/base_service.rb Lines 125 to 127 in e3b2cb5
I plan to work on this so at the minimum client.query returns a Report object with a Thanks! [1]
[2] https://github.com/ruckus/quickbooks-ruby/blob/e3b2cb50ff4605e625c0dffd54b752a753bfa23c/spec/fixtures/balancesheet.xml [3] quickbooks-ruby/lib/quickbooks/service/base_service.rb Lines 101 to 102 in e3b2cb5
[4]
|
I use the report service - the xml returns is pretty messy, and not easy to break down into smaller elements (for example it contains 'Rows' objects which contain one or more 'Row', and those can in turn contain one or more 'Rows' or 'Row'). It's not pleasant to work with, but that's exactly what I'm doing: using Nokogiri to break it down, manually parsing the entire response, to extract the data I need. I only need a couple of headline figures from a couple of very specific reports, though, so haven't revisited it to look at ways to make the response more of a flexible 'entity'. I have a function (where 'category' is actually just the string "reports") that is something like this:
I then have a controller that parses that XML. For example:
With the nesting of row(s) within row(s) it gets pretty messy and recursive after that... So, yes, it does work, but it could definitely benefit from some attention and improvement, in my opinion. |
Thanks @Craggar . Let us know @ratbeard if that solves it for you. With respect to improvements:
One improvement could be in |
Thanks for posting that @Craggar. I wrote a simple find_row() function yesterday as my use case is similar to yours, I just need to pick out a few 'Total' rows and will ignore the rest, and I don't care how deeply the Rows are nested. I was thinking this morning I actually want a flattened_rows function that returns a list of all rows without the nesting; then I can loop through each row and grab the data I care about and log out ones I don't. Just because I'm not sure what all the possible rows customers could have at this point and I want a little bit of debugging help at first. @minimul I agree that the way nested Rows are gross and providing better API's on top of that might not be worth the effort. What I was getting at above though is that if the only way to get access to the data is through
So given all that I think my improvements I'm suggesting would be:
report.find_row('Total Cost of Goods Sold')
=> ['Total Cost of Goods Sold', 2000, 2500] That last improvement can lead to a lot of bikeshedding and what not, so any ideas on an api would be very welcome, but regardless of it we should still definitely fix the other issues. |
Hi @ratbeard - good questions you raise. I havent used any of the Reporting stuff myself, so I havent noticed this before. You're right in that the One approach to instructing body = client.query('BalanceSheet', :raw => true)
xml = Nokogiri.parse(body) This would then allow us to rip out all of the the lines you highlighted: quickbooks-ruby/lib/quickbooks/service/base_service.rb Lines 125 to 127 in e3b2cb5
Anyways, it looks like this area could use some cleaning up and if you want to tackle that it would be much appreciated. Thank you! |
It looks like QBO recently exposed a reports API. I'd like to take a stab at implementing some of the more important reports (Balance Sheet, P&L).
Any tips as to approach? I was planning to create a Report base class and inherit for the individual reports, but I'm not sure how much is shared.
The text was updated successfully, but these errors were encountered: