Shopify / shopify-api-ruby

ShopifyAPI is a lightweight gem for accessing the Shopify admin REST and GraphQL web services.
MIT License
1.05k stars 468 forks source link

Shopify API did't work in rails console #1253

Closed dummydummydev closed 9 months ago

dummydummydev commented 9 months ago

Issue summary

I am working on rails + shopify App I want to list my webhooks and update the url of webhooks So I used REST API

ShopifyAPI::Webhook.all(session: test_session,api_version:'2023-10') ^^^^^^^^^ Did you mean? ShopifyAPI::Webhooks irb(main):011> ShopifyAPI::Webhooks.all(session: test_session,api_version:'2023-10') (irb):11:in <main>': undefined methodall' for ShopifyAPI::Webhooks:Module (NoMethodError)

ShopifyAPI::Webhooks.all(session: test_session,api_version:'2023-10') ^^^^ irb(main):012>

Product API

irb(main):015> test_session = ShopifyAPI::Auth::Session.new(shop: shop.shopify_domain, access_token: shop.shopify_token) =>

<ShopifyAPI::Auth::Session:0x00007fe8d3a4d738

... irb(main):016> ShopifyAPI::Product.count(session: test_session) (irb):16:in `

': uninitialized constant ShopifyAPI::Product (NameError)

ShopifyAPI::Product.count(session: test_session) ^^^^^^^^^ Did you mean? Proc irb(main):017> ShopifyAPI::Product.all(session: test_session) (irb):17:in `

': uninitialized constant ShopifyAPI::Product (NameError)

ShopifyAPI::Product.all(session: test_session) ^^^^^^^^^ Did you mean? Proc irb(main):018>

```shell
irb(main):018> test_session = ShopifyAPI::Auth::Session.new(shop: shop.shopify_domain, access_token: shop.shopify_token)
=> 
#<ShopifyAPI::Auth::Session:0x00007fe8d9582f18
...
irb(main):019* ShopifyAPI::Order.all(
irb(main):020*   session: test_session,
irb(main):021*   status: "any",
irb(main):022> )
(irb):19:in `<main>': uninitialized constant ShopifyAPI::Order (NameError)

ShopifyAPI::Order.all(
          ^^^^^^^
irb(main):023> 

Expected behavior

All The API Should Call and must show results

Actual behavior

Each API Giving error

Steps to reproduce the problem

  1. make an App with Shopify ruby template (https://github.com/Shopify/shopify-app-template-ruby/)
  2. Open Rails Console and Test it
matteodepalo commented 9 months ago

Hi @dummydummydev, could you give us more details to help us reproduce? It seems like ruby is failing to load the ShopifyAPI module, you might have to require it after you start the console.

github-actions[bot] commented 9 months ago

We are closing this issue because we did not hear back regarding additional details we needed to resolve this issue. If the issue persists and you are able to provide the missing clarification we need, feel free to respond and reopen this issue.

We appreciate your understanding as we try to manage our number of open issues.

sshaw commented 8 months ago

You must do proper setup so Zeitwerk can load the constants for you. See https://github.com/Shopify/shopify-api-ruby/issues/1263#issuecomment-1888387585