Skip to content

Instantly share code, notes, and snippets.

@gterrill
Last active February 25, 2017 01:20
Show Gist options
  • Save gterrill/c8e8ba58806cb4fc6253cfa257f0daab to your computer and use it in GitHub Desktop.
Save gterrill/c8e8ba58806cb4fc6253cfa257f0daab to your computer and use it in GitHub Desktop.
Request Store Access via Shopify Partner Dashboard using Mechanize
require 'rubygems'
require 'mechanize'
STORE = 'foo.myshopify.com'
a = Mechanize.new
# login
a.get('https://app.shopify.com/services/partners/auth/login') do |page|
page.form_with(action: '/services/partners/auth/login') do |form|
form.login = 'partner@shopifydevshop.com'
form.password = 'secret'
end.submit
end
# request store access
a.get('https://app.shopify.com/services/partners/store_accounts/new') do |page|
page.form_with(action: '/services/partners/store_accounts') do |form|
form.field_with(name: 'partner_store_access[shop_permanent_domain]').value = STORE
%w(allow_products allow_applications allow_themes).each do |permission|
form.checkbox_with(name: "partner_store_access[#{permission}]").check
end
end.submit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment