Repository is archived
No commit activity in last 3 years
No release in over 3 years
Shopify client library resource helpers
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.6
= 0.52.0

Runtime

 Project Readme

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)