Skip to content

ScreenStaring/shopify_url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shopify URL

Build Status

Build URLs to Shopify web pages.

Usage

Admin URLs

require "shopify_url"

url = ShopifyURL::Admin.new("shopname")

# https://shopname.myshopify.com/admin"
url.to_s

# https://shopname.myshopify.com/admin/orders
url.orders

# https://shopname.myshopify.com/admin/orders/6303508996
url.order(6303508996)

# https://shopname.myshopify.com/admin/products
url.products

# https://shopname.myshopify.com/admin/products/345323423
url.product(345323423)

# https://shopname.myshopify.com/admin/products/345323423/variants/2421342331
url.product(345323423).variant(2421342331)

See the RDocs for a complete list of methods.

Store URLs

require "shopify_url"

url = ShopifyURL::Store.new("shopname")  # you can also use your top-level domain

# https://shopname.myshopify.com/collections
url.collections

# https://shopname.myshopify.com/collections/amaaaaazing-thangz
url.collection("amaaaaazing-thangz")

See the RDocs for a complete list of methods.

Query String Parameters

All Shopify URL generation methods accept a Hash of query string parameters:

url = ShopifyURL::Store.new("shopname")  # you can also use your top-level domain

# https://shopname.myshopify.com/products/some-handle?tracking=data
url.products("some-handle", :tracking => "data")

License

The gem is available as open source under the terms of the MIT License.


Made by ScreenStaring