2017-06-13 59 views
0

我是新來Shopify應用程序開發和ROR。我工作的一個Shopify應用程序,在這裏我需要與客戶頁面(前端)上的更多信息一起顯示產品的詳細信息。從官方文檔我的理解是可以使用代理來完成。我也feeded我的代理網址(URL,子路等...),以我的應用程序。Shopify + ROR +無法檢索產品列表和發送使用代理來查看Shopify前端

,我能夠給我的Shopify商店中查看我的代理頁面。但是,雖然我收集控制器中的自定義產品列表,它會拋出,

ActionView::Template::Error (Failed to open TCP connection to dfbcde0b66b220d0b8b1da94205cea9c:443 (getaddrinfo: Name or service not known)) 

錯誤。並且檢索到的數據也無法在視圖中訪問。

這裏是我的控制器

class PersonalizerController < ApplicationController 
    include ShopifyApp::AppProxyVerification 
    include ShopifyAPI 
    def index 
    @shop = ShopifyApp::SessionRepository.retrieve(2) 
    ShopifyAPI::Base.activate_session(@shop) 
    ShopifyAPI::Shop.current 
    ShopifyAPI::Base.site = "https://#{ShopifyApp.configuration.api_key}:#"[email protected]+"@#{params[:shop]}/admin" 
    if(params[:pid].present?) 
     @fonts = Font.order('id DESC') 
     @shapes = Shape.order('id DESC') 
     @clipartcategories = Clipartcategory.order('id DESC') 
     // This line is causing TCP error 
     @pdt = ShopifyAPI::Product.find(params[:pid]) 
     @product_id = params[:pid] 
     @productoption = Productoption.where(product_id: params[:pid]) 
    else 
     puts "hello" 
    end 
    end 
end 

我堅持這個了整整一天,任何建議還是我錯過理解的概念。請澄清。

回答

0

您的網址是壞

"https://#{ShopifyApp.configuration.api_key}:#"[email protected]+"@#{params[:shop]}/admin"

這是你如何在Ruby中做推斷。

"https://#{ShopifyApp.configuration.api_key}:#{@shop.token}#{params[:shop]}/admin"

+0

謝謝!有效... –