Open bgetting opened 13 years ago
Can you post the stack trace please.
On Thu, Jun 16, 2011 at 1:24 PM, bgetting < reply@reply.github.com>wrote:
Using the following gem combination:
shopify_app 1.0.1 shopify_api 1.2.5 shopify-api-limits
I can run all API calls successfully by setting the ShopifyAPI::Base.site for my store, but when I try and run any of the methods from the API limits gem (such as ShopifyAPI.credit_left) I get the following error:
ArgumentError: Missing site URI
Is this a compatibility issue or am I doing something wrong? Thanks for any help that you can provide, I appreciate it.
Reply to this email directly or view it on GitHub: https://github.com/christocracy/shopify-api-limits/issues/1
Chris Scott Transistor Software http://www.transistorsoft.com
Sure. I've been just testing it out in the console, but here is the stack trace that is output:
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/activeresource-3.0.7/lib/active_resource/connection.rb:32:in initialize' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/activeresource-3.0.7/lib/active_resource/base.rb:537:in
new'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/activeresource-3.0.7/lib/active_resource/base.rb:537:in connection' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:58:in
response'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:68:in api_credit_limit_param' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:40:in
credit_limit'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:17:in credit_left' from (irb):31 from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in
start'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in start' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/commands.rb:23:in
<top (required)>'
from script/rails:6:in require' from script/rails:6:in
Please show me some simple test-code that produces your error.
On Thu, Jun 16, 2011 at 1:59 PM, bgetting < reply@reply.github.com>wrote:
Sure. I've been just testing it out in the console, but here is the stack trace that is output:
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/activeresource-3.0.7/lib/active_resource/connection.rb:32:in
initialize' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/activeresource-3.0.7/lib/active_resource/base.rb:537:in
new' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/activeresource-3.0.7/lib/active_resource/base.rb:537:inconnection' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:58:in
response' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:68:inapi_credit_limit_param' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:40:in
credit_limit' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:17:incredit_left' from (irb):31 from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in
start' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/commands/console.rb:8:instart' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/commands.rb:23:in
<top (required)>' from script/rails:6:inrequire' from script/rails:6:in
' Reply to this email directly or view it on GitHub:
https://github.com/christocracy/shopify-api-limits/issues/1#issuecomment-1382964
Chris Scott Transistor Software http://www.transistorsoft.com
No problem. Here is what I am doing. As I mentioned, I am just testing to see how it works before getting into writing actual code:
s = Store.find(:first) # returns a store object ShopifyAPI::Base.site = s.store_site # sets the URL p = ShopifyAPI::Product.count # returns 4 l = ShopifyAPI.credit_maxed? # returns error above l = ShopifyAPI.credit_left # returns error above
Interesting.
On Thu, Jun 16, 2011 at 2:05 PM, bgetting < reply@reply.github.com>wrote:
No problem. Here is what I am doing. As I mentioned, I am just testing to see how it works before getting into writing actual code:
s = Store.find(:first) # returns a store object ShopifyAPI::Base.site = s.store_site # sets the URL p = ShopifyAPI::Product.count # returns 4 l = ShopifyAPI.credit_maxed? # returns error above l = ShopifyAPI.credit_left # returns error above
Reply to this email directly or view it on GitHub:
https://github.com/christocracy/shopify-api-limits/issues/1#issuecomment-1383017
Chris Scott Transistor Software http://www.transistorsoft.com
That's great news.I'll give it a try. The actual app will be built using Rails 3.1, which I believe does not include any changes to ActiveResource. Thanks for your help with this, I appreciate it.
Perhaps your could summarize this thread, including your test-code and stack-trace into an Issue at https://github.com/christocracy/shopify-api-limits/issues
https://github.com/christocracy/shopify-api-limits/issuesThen others with same problem can find the solution as well.
On Thu, Jun 16, 2011 at 2:27 PM, bgetting < reply@reply.github.com>wrote:
That's great news.I'll give it a try. The actual app will be built using Rails 3.1, which I believe does not include any changes to ActiveResource. Thanks for your help with this, I appreciate it.
Reply to this email directly or view it on GitHub:
https://github.com/christocracy/shopify-api-limits/issues/1#issuecomment-1383220
Chris Scott Transistor Software http://www.transistorsoft.com
Oops. Just updated the bundle to use Rails 3.0.8, and I'm seeing the same thing. By setting the ShopifyAPI::Base.site it gives me the "missing site URI" error. By setting the ActiveResource::Base.site I get a NoMethodError:
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:68:in api_credit_limit_param' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:40:in
credit_limit'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:17:in credit_left' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:28:in
credit_maxed?'
from (irb):6
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands/console.rb:44:in start' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands/console.rb:8:in
start'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:23:in <top (required)>' from script/rails:6:in
require'
from script/rails:6:in `
I'm worried that I am doing something stupid...
try this in console and post the result
ActiveResource::Base.site =
Shop.current => #ShopifyAPI::Shop...
ActiveResource::Base.connection.response (I suspect you're seeing nil here) => #<Net::HTTPOK 200 OK readbody=true>
On Thu, Jun 16, 2011 at 2:33 PM, bgetting < reply@reply.github.com>wrote:
Oops. Just updated the bundle to use Rails 3.0.8, and I'm seeing the same thing. By setting the ShopifyAPI::Base.site it gives me the "missing site URI" error. By setting the ActiveResource::Base.site I get a NoMethodError:
NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:68:in
api_credit_limit_param' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:40:in
credit_limit' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:17:incredit_left' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:28:in
credit_maxed?' from (irb):6 from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands/console.rb:44:instart' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands/console.rb:8:in
start' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:23:in<top (required)>' from script/rails:6:in
require' from script/rails:6:in `' I'm worried that I am doing something stupid...
Reply to this email directly or view it on GitHub:
https://github.com/christocracy/shopify-api-limits/issues/1#issuecomment-1383254
Chris Scott Transistor Software http://www.transistorsoft.com
Thanks a ton for your help with this. The gem is a great idea, and much needed by people like me. It seems strange, as if I set the ActiveResource::Base.site directly, it works. However, any attempt to set ShopifyAPI::Base.site makes it fail.
It would be ideal if we could just set ShopifyAPI::Base.site, since our app sets that for each store that it needs to interact with and then sets it back to nil when it is finished.
Here is the console session where it works:
ruby-1.9.2-p0 > s = Store.first => #<Store id: 1, store_id: 634842, store_site: "https://aa17b7d22ad86e3f3019213792c693cd:34a14d346f...", domain: "raynor-heathcote5504.myshopify.com", email: "contact@terra-firma-design.com", name: "Terra Firma", mailchimp_apikey: "xxxxxxxxxxxxxxxxxxxxxxxxxx-us1", uninstalled_at: nil, created_at: "2011-04-26 06:50:41", updated_at: "2011-04-26 07:25:28"> ruby-1.9.2-p0 > ActiveResource::Base.site = s.store_site => "https://aa17b7d22ad86e3f3019213792c693cd:34a14d34xxxxa3843bd42f41593@raynor-heathcote5504.myshopify.com/admin" ruby-1.9.2-p0 > ActiveResource::Base.site => #<URI::HTTPS:0x00000104bd3d28 URL:https://aa17b7d22ad86e3f3019213792c693cd:34a14d34xxxxa3843bd42f41593@raynor-heathcote5504.myshopify.com/admin> ruby-1.9.2-p0 > ShopifyAPI.credit_maxed? => false ruby-1.9.2-p0 > ShopifyAPI.credit_left => 293 ruby-1.9.2-p0 > ActiveResource::Base.site = s.store_site => "https://aa17b7d22ad86e3f3019213792c693cd:34a14d34xxxxa3843bd42f41593@raynor-heathcote5504.myshopify.com/admin" ruby-1.9.2-p0 > ShopifyAPI.credit_left => 292 ruby-1.9.2-p0 > ShopifyAPI.credit_maxed? => false ruby-1.9.2-p0 > ShopifyAPI::Base.site = s.store_site => "https://aa17b7d22ad86e3f3019213792c693cd:34a14d34xxxxa3843bd42f41593@raynor-heathcote5504.myshopify.com/admin" ruby-1.9.2-p0 > ActiveResource::Base.connection.response => #<Net::HTTPOK 200 OK readbody=true> ruby-1.9.2-p0 > ShopifyAPI::Product.count => 6 ruby-1.9.2-p0 > ShopifyAPI.credit_left => 292 ruby-1.9.2-p0 > exit
Here is the console session that I was just playing with where it fails:
ruby-1.9.2-p0 > s = Store.first
=> #<Store id: 1, store_id: 634842, store_site: "https://aa17b7d22ad86e3f3019213792c693cd:34a14d346f...", domain: "raynor-heathcote5504.myshopify.com", email: "contact@terra-firma-design.com", name: "Terra Firma", mailchimp_apikey: "xxxxxxxxxxxxxxxxxxxxxxxxxx-us1", uninstalled_at: nil, created_at: "2011-04-26 06:50:41", updated_at: "2011-04-26 07:25:28">
ruby-1.9.2-p0 > ShopifyAPI::Base.site = s.store_site
=> "https://aa17b7d22ad86e3f3019213792c693cd:34a14d34xxxxa3843bd42f41593@raynor-heathcote5504.myshopify.com/admin"
ruby-1.9.2-p0 > ShopifyAPI.credit_maxed?
ArgumentError: Missing site URI
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/activeresource-3.0.8/lib/active_resource/connection.rb:32:in initialize' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/activeresource-3.0.8/lib/active_resource/base.rb:537:in
new'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/activeresource-3.0.8/lib/active_resource/base.rb:537:in connection' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:58:in
response'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:68:in api_credit_limit_param' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:40:in
credit_limit'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:17:in credit_left' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:28:in
credit_maxed?'
from (irb):3
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands/console.rb:44:in start' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands/console.rb:8:in
start'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:23:in <top (required)>' from script/rails:6:in
require'
from script/rails:6:in <main>' ruby-1.9.2-p0 > ActiveResource::Base.site = s.store_site => "https://aa17b7d22ad86e3f3019213792c693cd:34a14d34xxxxa3843bd42f41593@raynor-heathcote5504.myshopify.com/admin" ruby-1.9.2-p0 > ShopifyAPI.credit_left NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:68:in
api_credit_limit_param'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:40:in credit_limit' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:17:in
credit_left'
from (irb):5
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands/console.rb:44:in start' from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands/console.rb:8:in
start'
from /Users/briangetting/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:23:in <top (required)>' from script/rails:6:in
require'
from script/rails:6:in `
It's test store, in case that makes a difference. Hopefully this helps, and I'm really hoping that I am just doing something wrong...
Best I can tell, it works fine when you set ActiveResource::Base.site, but not when you set ShopifyAPI::Base.site.
I have this issue as well - bgetting your last comment indicates that you've got it working? How so? How can I tell what version of AR I'm using, and how can I upgrade it (or do I have to use edge rails)?
ShopifyAPI::Base.site = Shop.first.site => "shop_url" ActiveResource::Base.site = Shop.first.site => "shop_url" ActiveResource::Base.connection.response => nil ShopifyAPI.credit_used NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] from /Library/Ruby/Gems/1.8/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:68:in
api_credit_limit_param' from /Library/Ruby/Gems/1.8/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/shopify_api/limits.rb:50:in
credit_used' from (irb):4
Thanks for any help!
You can see which version of AR you are using by running 'gem list'. I got it working by just setting ActiveResource::Base.site instead of ShopifyAPI::Base.site.
3.0.7 it is. It worked - I just had to exit and re-open the console, and do only AR::Base.site
Strike that - new error:
ActiveResource::Base.site = Shop.first.site => "shop_url" ShopifyAPI::Order.first TypeError: singleton method bound for a different object from /Library/Ruby/Gems/1.8/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/active_resource/base.rb:21:in
bind' from /Library/Ruby/Gems/1.8/gems/shopify-api-limits-0.0.8/lib/shopify-api-limits/active_resource/base.rb:21:in
find_every' from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.7/lib/active_resource/base.rb:778:infind' from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.7/lib/active_resource/base.rb:790:in
first' from (irb):2
I get this "Missing site URI" error in Rails 3.1.0rc6. I ran through the shopify instructions to create an app. The generated controller includes:
@products = ShopifyAPI::Product.find(:all, :params => {:limit => 3})
Which works fine, but adding shopify_api and shopify-api-limits gems to Gemfile and changing 3 to false
it just 500s with ArgumentError: Missing site URI
.
Tried the code you suggest running at console, got:
> ActiveResource::Base.site = "https://treutel-lowe4664.myshopify.com"
=> "https://treutel-lowe4664.myshopify.com"
> Shop.current
NameError: uninitialized constant Shop
I see you're using ruby 1.8. The gem does a hack to ActiveResource::Base which only works in ruby 1.9, I think.
Sorry, I didn't test it in 1.8 -- I made it for a case of beer offered by @hunkybill (WHICH HE STILL OWES ME!!! :)
On Wed, Aug 17, 2011 at 3:34 PM, pushcx < reply@reply.github.com>wrote:
I get this "Missing site URI" error in Rails 3.1.0rc6. I ran through the shopify instructions to create an app. The generated controller includes:
@products = ShopifyAPI::Product.find(:all, :params => {:limit => 3})
Which works fine, but adding shopify_api and shopify-api-limits gems to Gemfile and changing 3 to
false
it just 500s withArgumentError: Missing site URI
.Tried the code you suggest running at console, got:
ActiveResource::Base.site = "https://treutel-lowe4664.myshopify.com" => "https://treutel-lowe4664.myshopify.com" Shop.current NameError: uninitialized constant Shop
Reply to this email directly or view it on GitHub:
https://github.com/christocracy/shopify-api-limits/issues/1#issuecomment-1829731
Chris Scott Transistor Software http://www.transistorsoft.com
No, my ruby --version says: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Using the following gem combination:
shopify_app 1.0.1 shopify_api 1.2.5 shopify-api-limits
I can run all API calls successfully by setting the ShopifyAPI::Base.site for my store, but when I try and run any of the methods from the API limits gem (such as ShopifyAPI.credit_left) I get the following error:
ArgumentError: Missing site URI
Is this a compatibility issue or am I doing something wrong? Thanks for any help that you can provide, I appreciate it.