- rails new MyShop --database=postgresql
- rails active_storage:install
- Add spina and spinga shop gems to Gemfile
- rails g spina:install
- rails g spina:shop:install
- rails spina_shop:import_countries
This file contains hidden or 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 'google/apis/drive_v3' | |
require "googleauth" | |
credentials = | |
Google::Auth::UserRefreshCredentials.new( | |
client_id: "854280762506-lrrj2ajqh9b.apps.googleusercontent.com", | |
client_secret: "jWiGrijiFCNRmig1s3aQt", | |
scope: ["https://www.googleapis.com/auth/drive"], | |
additional_parameters: { "access_type" => "offline" }) | |
This file contains hidden or 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 'google/apis/drive_v3' | |
# Create object of the drice service | |
service = Google::Apis::DriveV3 | |
# Authorize it with the help of credentials generated | |
service.authorization = credentials |
This file contains hidden or 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 "googleauth" | |
redentials = | |
Google::Auth::UserRefreshCredentials.new( | |
client_id: "3453463453ghjejfrekjfrekgjher.apps.googleusercontent.com", | |
client_secret: "dnbddfjfjkffrfrfj", | |
scope: ["https://www.googleapis.com/auth/drive"], # enter the scope for a service whichever you want to use | |
additional_parameters: { "access_type" => "offline" }) # DO not forgot to add this | |
# Set the refresh token |
This file contains hidden or 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
# Commented the following line, moved it to omniauth.rb | |
# config.omniauth :google_oauth2, Settings.google.client_id, Settings.google.client_secret, { access_type: "offline", approval_prompt: "" } |
This file contains hidden or 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
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }, | |
path_names: { sign_in: '' } |
This file contains hidden or 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
class User < ApplicationRecord | |
# Include default devise modules. Others available are: | |
# :confirmable, :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :rememberable, :trackable, :validatable, :omniauthable | |
end |
This file contains hidden or 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
class User < ApplicationRecord | |
# Include default devise modules. Others available are: | |
# :confirmable, :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable | |
end |
This file contains hidden or 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
mailer_jobs_count = ActionMailer::DeliveryJob.queue_adapter.enqueued_jobs.count{ |x| x[:job] == ActionMailer::DeliveryJob && x[:args].last == feed.id} | |
expect(mailer_jobs_count).to eq 1 |
This file contains hidden or 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
# assumption: configured as per https://github.com/Shopify/shopify_app#managing-api-keys | |
class Shopify::ProductService | |
def new | |
# get valid session to connect with the target store | |
session = ShopifyAPI::Session.new("your shop shopify_domain", "your shop shopify_token") | |
ShopifyAPI::Base.activate_session(session) | |
end | |
def products |