Deprecation Notice
This gem is no longer maintained.
For an actively maintained fork please refer to ReverseRetail/plenty_client.
PlentyClient
This Client is a ruby wrapper around the PlentyMarkets REST API.
The complete documentation can be found here.
Installation
Add this line to your application's Gemfile:
gem 'plenty_client'
And then execute:
bundle install
Or install it yourself as:
gem install plenty_client
Getting Started
Configuration
PlentyClient is a simple Ruby library. It works with Rails, as well as in a simple irb. Make sure you configure the PlentyClient with the following options:
PlentyClient::Config.site_url = 'http://plenty7.plentymarkets.de/rest'
PlentyClient::Config.api_user = 'myusername'
PlentyClient::Config.api_password = 'mypassword'
PlentyClient::Config.log = true || false
PlentyClient::Config.plenty_id = 111111
Calls
Note:
- required parameters need to be passed in, otherwise you will receive an PlentyClient::ResponseError
- This Client handles no validation, it is only a gateway to the API
Once you are set up you can use the client like so:
PlentyClient::Item.find(103)
PlentyClient::Item::Variation.find(103, 105)
PlentyClient::Item.list
PlentyClient::Item::Variation.list
PlentyClient::Item.create(parameters)
PlentyClient::Item::Variation.update(103, update_parameters)
PlentyClient::Item::Variation.destroy(103, 105)
# Use blocks to iterate in batches
PlentyClient::Item.list do |item|
puts item
end
# You can set optional headers after the required parameters of each request
PlentyClient::Item::Variation.list(103, { 'itemsPerPage' => 1, 'page' => 4 }) do |item|
puts item
end
Warnings
There is a difference in the get method with and without a block.
The Call without the block will return the complete response.
With the block you will only receive the entries.
Debugging
If you are not sure which required parameters to pass in simply call
PlentyClient::Item::Variation.routes
Todo:
- write some specs
- clean up
plenty_client/request.rb
- create classes for
- missing OrderItem OrderItemDate - its just a mess
- missing OrderProperty - its just a mess
- missing OrderItem OrderItemProperty - its just a mess
- update all modules to classes and make it inherit from a base class to remove
extend PlentyClient::Request
etc - create a configure block to set authentication parameters
Contributing
Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.