Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

kj/lucid-shopify-resource

Repository files navigation

lucid-shopify-resource

Installation

Add the gem to your ‘Gemfile’:

gem 'lucid-shopify'
gem 'lucid-shopify-resource'

Usage

Create a resource

class OrderRepository
  include Lucid::Shopify::Resource::Create

  resource :orders
end

order_repo = OrderRepository.new

order_repo.create(credentials, new_order)

Delete a resource

class OrderRepository
  include Lucid::Shopify::Resource::Delete

  resource :orders
end

order_repo = OrderRepository.new

order_repo.delete(credentials, id)

Read a resource

Include and configure Read:

class OrderRepository
  include Lucid::Shopify::Resource::Read

  resource :orders

  default_params fields: %w[id tags], limit: 250
end

order_repo = OrderRepository.new

order_repo.find(credentials, id)

The OrderRepository class is enumerable. Each page is fetched from the API as needed, rather than all at once:

order_repo = OrderRepository.new

order_repo.each(credentials) |order|
  # ...
end

Update a resource

class OrderRepository
  include Lucid::Shopify::Resource::Update

  resource :orders
end

order_repo = OrderRepository.new

order_repo.create(credentials, id, order)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages