Last active
February 25, 2017 01:20
-
-
Save gterrill/c8e8ba58806cb4fc6253cfa257f0daab to your computer and use it in GitHub Desktop.
Request Store Access via Shopify Partner Dashboard using Mechanize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = '[email protected]' | |
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