Giter Club home page Giter Club logo

spree_shopify_importer's Introduction

Build Status Code Climate Test Coverage

Spree Shopify Importer

The Spree Shopify Importer gem allows you to easily import data from Shopify store to Spree application. It's compatible with Spree 3.2 and above.

Behind-the-scenes, this extension is using Shopify API gem.

Currently, it's in version 0.1.0. It has been tested with thousands of real life orders, but we welcome new pull requests!

Installation

  1. Add this extension to your Gemfile with this:
gem 'spree_shopify_importer', github: 'spree-contrib/spree_shopify_importer'
gem 'spree_address_book', github: 'spree-contrib/spree_address_book'
gem 'spree_auth_devise', '~> 3.3'
  1. Install the gem using Bundler:
bundle install
  1. Copy & run migrations:
bundle exec rails g spree_shopify_importer:install
  1. Restart your server:

If your server was running, restart it so that it can find the assets properly.

  1. Setup credentials and change default values if needed.

Getting Started

We are recommending using sidekiq for background processing with this stack of gems:

gem 'sidekiq'
gem 'sidekiq-limit_fetch'
gem 'sidekiq-unique-jobs'

We also recommend having a limit 2 for import queue, due to API limit. Default queue name is default but it can be changed in Spree::AppConfiguration under shopify_import_queue key.

Default values

All default values are saved in Spree::AppConfiguration

  • ShopifyAPI credentials - used for api authorization.
    • shopify_api_key - nil
    • shopify_password - nil
    • shopify_shop_domain - nil
    • shopify_token - nil
  • Import Rescue Limit - used for retrying API errors, for example API limit hit.
    • shopify_rescue_limit - 5
  • Import Queue Name
    • shopify_import_queue - 'default'

Import

Currently, you need to have access to the console to start the import.

  1. To start import, in console run:

With default values

 SpreeShopifyImporter::InvokerJob.new.import!

or with credentials.

 SpreeShopifyImporter::InvokerJob.new(credentials).import!

Where credentials could have two formats:

    {
      credentials: {
        api_key: 'api_key', 
        password: 'password',
        shop_domain: 'shop_domain'
      }
    }

or

    {
      credentials: {
        token: 'token',
        shop_domain: 'shop_domain'
      }
    }

Import Model

  1. SpreeShopifyImporter::DataFeed - this model contains copy of JSON imported from shopify and association to spree object.

Import Services

Import services are divided into four main parts. Each of them could be customized.

  1. Data Fetchers are services which are fetching products, users, orders and collections from Shopify.

  2. Importers are services which are saving Shopify data feeds (as shadow copy of import), and starting a create or update action for spree object.

  3. Data Savers are services which are saving spree objects, each of them has a parser method which can be overridden to change update/create attributes and associations.

  4. Data Parsers are services which are changing Shopify data to spree data.

Testing

To run all the tests for the build, clone the repo and run:

bundle exec rake

This will generate a dummy app for testing, run rubocop style checker and rspec tests.

When testing your applications integration with this extension you may use its factories. Simply add this require statement to your spec_helper:

require 'spree_shopify_importer/factories'

Contributing

We welcome new pull requests!

License

Spree Shopify Importer is copyright © 2015-2018 Spark Solutions Sp. z o.o.. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About Spark Solutions

Spark Solutions

Spree Shopify Importer is maintained and funded by Spark Solutions Sp. z o.o. The names and logos are trademarks of Spark Solutions Sp. z o.o.

We are passionate about open source software. We are available for hire.

spree_shopify_importer's People

Contributors

argonus avatar damianlegawiec avatar mafi88 avatar matthewkennedy avatar vfonic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.