Coder Social home page Coder Social logo

Comments (7)

ruckus avatar ruckus commented on July 24, 2024

Odd. What version of Quickeebooks are you using?

In a console with 0.1.1 loaded (which is actually trailing latest of 0.1.3):

1.9.3p327 > d1 = Time.mktime(2011, 5, 1)
=> 2011-05-01 00:00:00 -0700
1.9.3p327 > d2 = Time.mktime(2011, 8, 1)
=> 2011-08-01 00:00:00 -0700
1.9.3p327 > Quickeebooks::Windows::Service::Filter.new(:datetime, :field => 'CreateTime', :after => d1, :before => d2)
=> CreateTime :BEFORE: 2011-08-01T00:00:00-0700 :AND: CreateTime :AFTER: 2011-05-01T00:00:00-0700

On Mar 21, 2013, at 1:48 PM, Michael Whitley [email protected] wrote:

I set up this controller based on one of the examples

class AtestController < ApplicationController
def index
if session[:access_token]
filters = []

        d1 = Time.mktime(2011, 5, 1)
        d2 = Time.mktime(2011, 8, 1)
        filters << Quickeebooks::Windows::Service::Filter.new(:datetime, :field => 'CreateTime', :after => d1, :before => d2)

        customer_service = Quickeebooks::Windows::Service::Customer.new
        customer_service.access_token = session[:access_token]
        customer_service.realm_id = session[:realm_id]
        customer_service.list

        customers = customer_service.list(filters, 1, 30, nil)
    end
end

end
And rails throws the following error

ArgumentError at /atest
Don't know how to generate a Filter for type datetime
I know that CreateTime isn't a queryable field for Customer from this page

https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0500_QuickBooks_Windows/0600_Object_Reference/Customer

but it appears that all the DateTime queryable fields only accept one DateTime, not ranges like are specified by the :before and :after.


Reply to this email directly or view it on GitHub.

from quickeebooks.

bodagetta avatar bodagetta commented on July 24, 2024

I'm sourcing it from the repo

gem 'quickeebooks', :github => 'ruckus/quickeebooks'

so I can get the new services

I just tried that in the console and got the same response that you did

irb(main):007:0> Quickeebooks::Windows::Service::Filter.new(:datetime, :field => 'CreateTime', :after => d1, :before => d2)
=> CreateTime :BEFORE: 2011-08-01T00:00:00Central Daylight Time :AND: CreateTime :AFTER: 2011-05-01T00:00:00Central Daylight Time

I'm not sure where to go next in the debugging process.

from quickeebooks.

ruckus avatar ruckus commented on July 24, 2024

Weird indeed. Check out the output from your console - it includes the timezone (Central Daylight Time) which I would imagine would fail if it made it to Intuit.

What exact version of Ruby you on?

On Mar 21, 2013, at 2:03 PM, Michael Whitley [email protected] wrote:

I'm sourcing it from the repo

gem 'quickeebooks', :github => 'ruckus/quickeebooks'
so I can get the new services

I just tried that in the console and got the same response that you did

irb(main):007:0> Quickeebooks::Windows::Service::Filter.new(:datetime, :field => 'CreateTime', :after => d1, :before => d2)
=> CreateTime :BEFORE: 2011-08-01T00:00:00Central Daylight Time :AND: CreateTime :AFTER: 2011-05-01T00:00:00Central Daylight Time
I'm not sure where to go next in the debugging process.


Reply to this email directly or view it on GitHub.

from quickeebooks.

bodagetta avatar bodagetta commented on July 24, 2024

So here's a little more on the error, it's actually when the .list is called

irb(main):014:0> customers = customer_service.list(filters, 1, 30, nil)
ArgumentError: Don't know how to generate a Filter for type datetime
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/quickeebooks-c3fd766e575b/lib/quickeebooks/shared/service/filter.rb:49:in `t
o_xml'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/quickeebooks-c3fd766e575b/lib/quickeebooks/windows/service/service_base.rb:9
4:in `block in fetch_collection'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/quickeebooks-c3fd766e575b/lib/quickeebooks/windows/service/service_base.rb:9
4:in `collect'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/quickeebooks-c3fd766e575b/lib/quickeebooks/windows/service/service_base.rb:9
4:in `fetch_collection'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/quickeebooks-c3fd766e575b/lib/quickeebooks/windows/service/customer.rb:9:in
`list'
        from (irb):14
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

looks like the error is in

/lib/quickeebooks/shared/service/filter.rb

there isn't a :datetime option under the to_xml function. Should there be?

from quickeebooks.

ruckus avatar ruckus commented on July 24, 2024

Ah ok, this makes sense. Yes, I totally see the problem now.

Also this highlights that my request generation testing is pretty piss poor.

I'll try and get a fix out in the next day or so.

On Mar 21, 2013, at 2:16 PM, Michael Whitley [email protected] wrote:

So here's a little more on the error, it's actually when the .list is called

irb(main):014:0> customers = customer_service.list(filters, 1, 30, nil)
ArgumentError: Don't know how to generate a Filter for type datetime
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/quickeebooks-c3fd766e575b/lib/quickeebooks/shared/service/filter.rb:49:in t o_xml' from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/quickeebooks-c3fd766e575b/lib/quickeebooks/windows/service/service_base.rb:9 4:inblock in fetch_collection'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/quickeebooks-c3fd766e575b/lib/quickeebooks/windows/service/service_base.rb:9
4:in collect' from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/quickeebooks-c3fd766e575b/lib/quickeebooks/windows/service/service_base.rb:9 4:infetch_collection'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/quickeebooks-c3fd766e575b/lib/quickeebooks/windows/service/customer.rb:9:in
list' from (irb):14 from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:instart'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in start' from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'
looks like the error is in

/lib/quickeebooks/shared/service/filter.rb

there isn't a :datetime option under the to_xml function. Should there be?


Reply to this email directly or view it on GitHub.

from quickeebooks.

bodagetta avatar bodagetta commented on July 24, 2024

I implemented a datetime_to_xml function in my forked repo. I had to use @value.xmlschema to get the datetime in the right format. If i used formatted_time(@value) it was not formatted correctly. I think we saw this earlier when my system included the timezone.

I have this code in my controller

if session[:access_token]
            filters = []
            datetime = Time.mktime(2011, 2, 25)
            filters << Quickeebooks::Shared::Service::Filter.new(:datetime, :field => 'StartCreatedTMS', :value => datetime)
            #filters << Quickeebooks::Shared::Service::Filter.new(:boolean, :field => 'IncludeTimeEntryEnum', :value => true)
            employees = Quickeebooks::Windows::Service::Employee.new
            employees.access_token = session[:access_token]
            employees.realm_id = session[:realm_id]
            @all_employees = employees.list(filters, page = 1, per_page = 50, sort = nil, options = {})
        end

If I only have the first filter, then I get this error

IntuitRequestException at /atest
cvc-complex-type.2.4.a: Invalid content was found starting with element 'StartPage'. One of '{"http://www.intuit.com/sb/cdm/v2":EndCreatedTMS, "http://www.intuit.com/sb/cdm/v2":SortByColumn, "http://www.intuit.com/sb/cdm/v2":FirstLastName, "http://www.intuit.com/sb/cdm/v2":FirstLastEnd, "http://www.intuit.com/sb/cdm/v2":FirstLastStart, "http://www.intuit.com/sb/cdm/v2":FirstLastInside, "http://www.intuit.com/sb/cdm/v2":IncludeTimeEntryEnum}' is expected.

So, I added in the second filter (commented in the controller code above) and now I get this error.

IntuitRequestException at /atest
cvc-complex-type.2.4.d: Invalid content was found starting with element 'StartPage'. No child element is expected at this point.

from quickeebooks.

bodagetta avatar bodagetta commented on July 24, 2024

The API is sensitive to order of the query fields. I moved the StartPage and ChunkSize fields to come before the passed through filter fields. A pull request has been issued.

from quickeebooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.