<commit_before>DpdApi
======

:small_red_triangle_down: Ruby implementation for [DPD](http://dpd.ru)'s SOAP API

[![Gem Version](https://badge.fury.io/rb/dpd_api.svg)](http://badge.fury.io/rb/dpd_api)
[![Build Status](https://travis-ci.org/itsNikolay/dpd_api.svg)](https://travis-ci.org/itsNikolay/dpd_api)
[![Code Climate](https://codeclimate.com/github/itsNikolay/dpd_api/badges/gpa.svg)](https://codeclimate.com/github/itsNikolay/dpd_api)
[![Test Coverage](https://codeclimate.com/github/itsNikolay/dpd_api/badges/coverage.svg)](https://codeclimate.com/github/itsNikolay/dpd_api)

Installation
------------

### Rails

```ruby
# Gemfile
gem 'dpd_api'
```

```ruby
# config/initializers/dpd_api.rb
DpdApi.configure do |config|
  config.client_key    = 'ASD7686ASD76786786786786AASD'
  config.client_number = '123456789'
  config.base_url = Rails.env.production? ? 'http://ws.dpd.ru' : 'http://wstest.dpd.ru'
end
```

### Ruby
```ruby
gem install dpd_api
```

```ruby
require 'dpd_api'

client_key    = 'ASD7686ASD76786786786786AASD'
client_number = '123456789'
DpdApi.configure { |c| c.client_key = client_key; c.client_number = client_number; }
```

Quickstart
----------

```ruby
params = { pickup:   { city_id: 195851995 },
           delivery: { city_id: 48951627 },
           self_pickup:   false,
           self_delivery: false,
           weight: 1, }

DpdApi::Calculator.service_cost(params)

#=> [{:service_code=>"TEN", :service_name=>"DPD 10:00", :cost=>"2228.67", :days=>"4"}, {:service_code=>"DPT", :service_name=>"DPD 13:00", :cost=>"1966.47", :days=>"4"}, . . .]
```

Table of content
----------------
* DpdApi::Geography
  * .cities_cash_pay
  * .terminals_self_delivery
  * .parcel_shops
* DpdApi::Calculator
  * .service_cost
  * .service_cost_by_parcels
* DpdApi::Order
  * .create_order
  * .order_status
  * .create_address
  * .update_address
  * .cancel_order
  * .add_parcels
  * .remove_parcels
  * .invoice_file
* DpdApi::Tracing
  * .states_by_client_order
  * .states_by_client_parcel<commit_msg>test link<commit_after>DpdApi
======

:small_red_triangle_down: Ruby implementation for [DPD](http://dpd.ru)'s SOAP API

[![Gem Version](https://badge.fury.io/rb/dpd_api.svg)](http://badge.fury.io/rb/dpd_api)
[![Build Status](https://travis-ci.org/itsNikolay/dpd_api.svg)](https://travis-ci.org/itsNikolay/dpd_api)
[![Code Climate](https://codeclimate.com/github/itsNikolay/dpd_api/badges/gpa.svg)](https://codeclimate.com/github/itsNikolay/dpd_api)
[![Test Coverage](https://codeclimate.com/github/itsNikolay/dpd_api/badges/coverage.svg)](https://codeclimate.com/github/itsNikolay/dpd_api)

Installation
------------

### Rails

```ruby
# Gemfile
gem 'dpd_api'
```

```ruby
# config/initializers/dpd_api.rb
DpdApi.configure do |config|
  config.client_key    = 'ASD7686ASD76786786786786AASD'
  config.client_number = '123456789'
  config.base_url = Rails.env.production? ? 'http://ws.dpd.ru' : 'http://wstest.dpd.ru'
end
```

### Ruby
```ruby
gem install dpd_api
```

```ruby
require 'dpd_api'

client_key    = 'ASD7686ASD76786786786786AASD'
client_number = '123456789'
DpdApi.configure { |c| c.client_key = client_key; c.client_number = client_number; }
```

Quickstart
----------

```ruby
params = { pickup:   { city_id: 195851995 },
           delivery: { city_id: 48951627 },
           self_pickup:   false,
           self_delivery: false,
           weight: 1, }

DpdApi::Calculator.service_cost(params)

#=> [{:service_code=>"TEN", :service_name=>"DPD 10:00", :cost=>"2228.67", :days=>"4"}, {:service_code=>"DPT", :service_name=>"DPD 13:00", :cost=>"1966.47", :days=>"4"}, . . .]
```

Table of content
----------------
* [DpdApi::Geography](#dpdapigeography)
  * .cities_cash_pay
  * .terminals_self_delivery
  * .parcel_shops
* DpdApi::Calculator
  * .service_cost
  * .service_cost_by_parcels
* DpdApi::Order
  * .create_order
  * .order_status
  * .create_address
  * .update_address
  * .cancel_order
  * .add_parcels
  * .remove_parcels
  * .invoice_file
* DpdApi::Tracing
  * .states_by_client_order
  * .states_by_client_parcel
{'fraction_non_alphanumeric': 0.18894348894348895, 'fraction_numerical': 0.046191646191646195, 'mean_word_length': 4.114321608040201, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7068969', 'n_tokens_mistral': 1808, 'n_tokens_neox': 1617, 'n_words': 204}