Class: LucidShopify::Authorise
- Inherits:
-
Object
- Object
- LucidShopify::Authorise
- Defined in:
- lib/lucid_shopify/authorise.rb
Constant Summary collapse
- Error =
Class.new(Error)
Instance Method Summary collapse
-
#call(myshopify_domain, authorisation_code) ⇒ String
Exchange an authorisation code for a new Shopify access token.
-
#initialize(client: Container[:client]) ⇒ Authorise
constructor
A new instance of Authorise.
Constructor Details
#initialize(client: Container[:client]) ⇒ Authorise
Returns a new instance of Authorise.
12 13 14 |
# File 'lib/lucid_shopify/authorise.rb', line 12 def initialize(client: Container[:client]) @client = client end |
Instance Method Details
#call(myshopify_domain, authorisation_code) ⇒ String
Exchange an authorisation code for a new Shopify access token.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/lucid_shopify/authorise.rb', line 26 def call(myshopify_domain, ) credentials = Credentials.new(myshopify_domain) data = @client.post_json(credentials, 'oauth/access_token', post_data()) raise Error if data['access_token'].nil? raise Error if data['scope'] != LucidShopify.config.scope data['access_token'] end |