Library to use PrestaShop in Ruby using its API.
- Read any resources provided by PrestaShop
- Only fetch resources data when needed
- Fetch all in a row when requested
- Provide collection and resources separatly as classes (e.g.
Products
andProduct
)
In Gemfile
:
gem 'restashop', git: 'https://github.com/opus-codium/restashop'
require 'restashop'
restashop = Restashop.new('http://prestashop.com/api', 'super secret token')
restashop.resources
restashop.products.list
suppliers = restashop.suppliers.all
suppliers.each { |s| puts s.name }
Note: it could be really slow on big shop. If you already know resource ID, prefer use find
.
first_order_id = restashop.orders.list.first
first_order = restashop.orders.find first_order_id
first_order.total_paid
restashop.products.where(id_supplier: 42)
bundle exec rspec