Class: OmniAuth::Strategies::Shopify
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Shopify
- Defined in:
- lib/omniauth/strategies/shopify.rb
Constant Summary collapse
- DEFAULT_SCOPE =
Available scopes: content themes products customers orders script_tags shipping read_* or write_*
'read_products'
Instance Method Summary collapse
- #authorize_params ⇒ Object
- #callback_url ⇒ Object
- #fix_https ⇒ Object
- #request_phase ⇒ Object
- #setup_phase ⇒ Object
- #valid_site? ⇒ Boolean
Instance Method Details
#authorize_params ⇒ Object
43 44 45 46 47 |
# File 'lib/omniauth/strategies/shopify.rb', line 43 def super.tap do |params| params[:scope] ||= DEFAULT_SCOPE end end |
#callback_url ⇒ Object
49 50 51 |
# File 'lib/omniauth/strategies/shopify.rb', line 49 def callback_url .callback_url || super end |
#fix_https ⇒ Object
26 27 28 |
# File 'lib/omniauth/strategies/shopify.rb', line 26 def fix_https [:client_options][:site].gsub!(/\Ahttp\:/, 'https:') end |
#request_phase ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/omniauth/strategies/shopify.rb', line 35 def request_phase if valid_site? super else fail!(:invalid_site) end end |
#setup_phase ⇒ Object
30 31 32 33 |
# File 'lib/omniauth/strategies/shopify.rb', line 30 def setup_phase super fix_https end |
#valid_site? ⇒ Boolean
22 23 24 |
# File 'lib/omniauth/strategies/shopify.rb', line 22 def valid_site? !!(/\A(https|http)\:\/\/[a-zA-Z0-9][a-zA-Z0-9\-]*\.#{Regexp.quote([:myshopify_domain])}[\/]?\z/ =~ [:client_options][:site]) end |