Dariusch/plenty_client

View on GitHub
README.md

Summary

Maintainability
Test Coverage
# Deprecation Notice

This gem is no longer maintained.

For an actively maintained fork please refer to [ReverseRetail/plenty_client](https://github.com/ReverseRetail/plenty_client).

# PlentyClient
[![Code Climate](https://codeclimate.com/github/Dariusch/plenty_client/badges/gpa.svg)](https://codeclimate.com/github/Dariusch/plenty_client)
[![Issue Count](https://codeclimate.com/github/Dariusch/plenty_client/badges/issue_count.svg)](https://codeclimate.com/github/Dariusch/plenty_client)
[![Test Coverage](https://codeclimate.com/github/Dariusch/plenty_client/badges/coverage.svg)](https://codeclimate.com/github/Dariusch/plenty_client/coverage)
[![Build Status](https://travis-ci.org/Dariusch/plenty_client.svg?branch=master)](https://travis-ci.org/Dariusch/plenty_client)
[![Gem Version](https://badge.fury.io/rb/plenty_client.svg)](https://badge.fury.io/rb/plenty_client)

This Client is a ruby wrapper around the PlentyMarkets REST API.  
The complete documentation can be found [here](https://developers.plentymarkets.com/rest-doc).  

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'plenty_client'
```

And then execute:
```ruby
bundle install
```

Or install it yourself as:
```ruby
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:

```ruby
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:  

```ruby
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

```ruby
PlentyClient::Item::Variation.routes
```

## Todo:

- write some specs
- clean up `plenty_client/request.rb`
* create classes for
  * [`Account`](https://developers.plentymarkets.com/rest-doc/account)
  * [~~`Accounting`~~](https://developers.plentymarkets.com/rest-doc/accounting)
  * [~~`Authentication`~~](https://developers.plentymarkets.com/rest-doc/authentication)
  * [~~`Authorization`~~](https://developers.plentymarkets.com/rest-doc/authorization)
  * [~~`Basket`~~](https://developers.plentymarkets.com/rest-doc/basket)
  * [~~`Category`~~](https://developers.plentymarkets.com/rest-doc/category)
  * [`Cloud`](https://developers.plentymarkets.com/rest-doc/cloud)
  * [~~`Comment`~~](https://developers.plentymarkets.com/rest-doc/comment)
  * [~~`Document`~~](https://developers.plentymarkets.com/rest-doc/document)
  * [`Export`](https://developers.plentymarkets.com/rest-doc/export)
  * [`ExportSettings`](https://developers.plentymarkets.com/rest-doc/export_settings)
  * [~~`Item`~~](https://developers.plentymarkets.com/rest-doc/item)
  * [`LegalInformation`](https://developers.plentymarkets.com/rest-doc/legal_information)
  * [~~`Listing`~~](https://developers.plentymarkets.com/rest-doc/listing)
  * [~~`Market`~~](https://developers.plentymarkets.com/rest-doc/market)
  * [~~`Order`~~](https://developers.plentymarkets.com/rest-doc/order)
  * [~~`OrderSummary`~~](https://developers.plentymarkets.com/rest-doc/order_summary)
  * [~~`Payment`~~](https://developers.plentymarkets.com/rest-doc/payment)
  * [`Plugins`](https://developers.plentymarkets.com/rest-doc/plugins)
  * [~~`StockManagement`~~](https://developers.plentymarkets.com/rest-doc/stock_management)
  * [~~`Ticket`~~](https://developers.plentymarkets.com/rest-doc/ticket)
  * [~~`Webstore`~~](https://developers.plentymarkets.com/rest-doc/webstore)
- missing [OrderItem OrderItemDate](https://developers.plentymarkets.com/rest-doc/order_order_item_order_item_date/details#get-all-order-item-dates-for-one-order-item-by-its-order-item-id) - its just a mess
- missing [OrderProperty](https://developers.plentymarkets.com/rest-doc/order#rest-orderproperty) - its just a mess
- missing [OrderItem OrderItemProperty ](https://developers.plentymarkets.com/rest-doc/order_order_item_order_item_property/details#get-all-order-item-propertys-for-one-order-item-by-its-order-item-id) - 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](http://contributor-covenant.org) code of conduct.


## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).