yandex-delivery 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ace5fa6ba5f600789f8e2b9a3b265c349b41bb08d4d1f4e9bd9cadc29efc95d7
4
- data.tar.gz: 5df92db3acc8ae0bd0d805ea6ecfe48ff5d314432d82209c2009105aa07c4b59
3
+ metadata.gz: 20948af6947ba0c5eacd0d0a8e0f46bf818f1a15eae22180309cc6781550a91a
4
+ data.tar.gz: 68fabec7fa939e083146b7f6ce8f8ebe701d5a1722aab54c09f4663ac09b8b67
5
5
  SHA512:
6
- metadata.gz: be081c9b8b8a6bfa927627f0590dd75a0a84a66827926b5911d7915d7ccaea1598bb097a5acd21b48881090a467a80f8a7f0441d4dc9a7d4bd6d42f4d7be426c
7
- data.tar.gz: b3f05e6c3762f59de904606a6127d94fb57989e0f1249ecc06155dea676d491daf8f54d47b309c8ff604c4b5dae61c58fd08ed4dfd88b2bea1bc271951aa02b7
6
+ metadata.gz: 052ef2f8e89462737a5db6fa555bec56945fba5907c93a302382aae0589c833f734bc4009f4a05b33fc5b4be37a7e80867dd7cb929a092d084d1a2003089c8d1
7
+ data.tar.gz: 258765b235e43f80a363a75eb724e824a7b414fe9b8b3e011d0a1c7c366f054d0a58bb909545d3787acf3b09fa4d3bcabbf82a3a4fadda7ebdbadc271a96cbe0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Pavel Osetrov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,83 @@
1
+ # Yandex-delivery
2
+
3
+ API wrapper для Яндекс.доставки [API](https://yandex.ru/dev/delivery-3/doc/dg/).
4
+
5
+ ## Установка Ruby
6
+
7
+ $ gem install yandex-delivery
8
+
9
+ ## Установка Rails
10
+
11
+ добавьте в Gemfile:
12
+
13
+ gem 'yandex-delivery'
14
+
15
+ и запустите `bundle install`.
16
+
17
+ Затем:
18
+
19
+ rails g yandex_delivery:install
20
+
21
+ ## Требования
22
+
23
+ Необходимо получить [токен авторизации](https://yandex.ru/dev/delivery-3/doc/dg/concepts/access.html).
24
+
25
+ ## Использование Rails
26
+
27
+ В файл `config/yandex_delivery2.yml` вставьте ваши данные из настоек яндекс доставки и токен авторизации
28
+
29
+ ## Использование Ruby
30
+
31
+ Сначала создайте экземпляр объекта `YandexDelivery::Request`:
32
+
33
+ ```ruby
34
+ delivery = YandexDelivery::Request.new(api_key: "your_access_token")
35
+ ```
36
+
37
+ Вы можете изменять `api_key`, `timeout`, `open_timeout`, `faraday_adapter`, `proxy`, `symbolize_keys`, `logger`, и `debug`:
38
+
39
+ ```ruby
40
+ YandexDelivery::Request.api_key = "your_access_token"
41
+ YandexDelivery::Request.timeout = 15
42
+ YandexDelivery::Request.open_timeout = 15
43
+ YandexDelivery::Request.symbolize_keys = true
44
+ YandexDelivery::Request.debug = false
45
+ ```
46
+
47
+ Либо в файле `config/initializers/yandex_delivery2.rb` для Rails.
48
+
49
+ ## Debug Logging
50
+
51
+ Pass `debug: true` to enable debug logging to STDOUT.
52
+
53
+ ```ruby
54
+ delivery = YandexDelivery::Request.new(api_key: "your_access_token", debug: true)
55
+ ```
56
+
57
+ ### Custom logger
58
+
59
+ Ruby `Logger.new` is used by default, but it can be overrided using:
60
+
61
+ ```ruby
62
+ delivery = YandexDelivery::Request.new(api_key: "your_access_token", debug: true, logger: MyLogger.new)
63
+ ```
64
+
65
+ Logger can be also set by globally:
66
+
67
+ ```ruby
68
+ YandexDelivery::Request.logger = MyLogger.new
69
+ ```
70
+
71
+ ## Примеры
72
+
73
+ ### Поиск вариантов доставки
74
+
75
+ ```ruby
76
+ # для Rails senderId указывать не обязательно, в запрос подставится значение из config/yandex_delivery2.yml
77
+ body = {
78
+ :to=>{:location=>"Санкт-Петербург"},
79
+ :dimensions=>{:length=>1, :height=>1, :width=>1, :weight=>1}
80
+ }
81
+
82
+ YandexDelivery::Request.delivery_options.upsert(body: body)
83
+ ```
@@ -1,3 +1,3 @@
1
1
  module YandexDelivery
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex-delivery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Osetrov
@@ -44,6 +44,8 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
+ - LICENSE
48
+ - README.markdown
47
49
  - lib/generators/yandex_delivery/install/USAGE
48
50
  - lib/generators/yandex_delivery/install/install_generator.rb
49
51
  - lib/generators/yandex_delivery/install/templates/yandex_delivery.rb