Class: HomeController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/shopify_app/templates/app/controllers/home_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



10
11
12
13
14
15
16
# File 'lib/generators/shopify_app/templates/app/controllers/home_controller.rb', line 10

def index
  # get 5 products
  @products = ShopifyAPI::Product.find(:all, :params => {:limit => 10})

  # get latest 5 orders
  @orders   = ShopifyAPI::Order.find(:all, :params => {:limit => 5, :order => "created_at DESC" })
end

#welcomeObject



5
6
7
8
# File 'lib/generators/shopify_app/templates/app/controllers/home_controller.rb', line 5

def welcome
  current_host = "#{request.host}#{':' + request.port.to_s if request.port != 80}"
  @callback_url = "http://#{current_host}/login/finalize"
end