yandex-delivery-api 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a0e331cdc3ad38d9c76d16c6977a838fe2db22c8747a55acf9824e7e589c9b8
4
- data.tar.gz: ba5ce10e91db80972a10794defde8553ecd3ea20cd807a0239269b4cefc6421d
3
+ metadata.gz: 8eeafe770711fdefa51885220e6b287036429d51fa90928ae51fd1742779dbbf
4
+ data.tar.gz: 209a7d641a843675ef6d9bcde7b074783c2aa4989ae4a78e4661dcf14a5f6232
5
5
  SHA512:
6
- metadata.gz: 495a1cf4d1ca3de5bf9bbb04cc626e2ccdad4f2ebccd046edccf3ff6993c37c6b830f1cf41e0ae6190b7ff7d35bd42a25a3440008a958c8ceea05fc4aace0ae7
7
- data.tar.gz: 384c24d700f8105b1d1710104f915b028f32f5e66183012df0e492cc112fe58f66cf46a73be23231a492fb4b45b4d7dc0ffa94f9424ebe264bf688aab5697258
6
+ metadata.gz: 9833f0924eab9d94e5ac6b1c34109a199b534f0a936dcc4b696b1c809729761c2928a1dbeffb74d576a710f5e5316b5852b9264534226ce590284893112177f0
7
+ data.tar.gz: 1ee3ea1717fa6a8d0c85a58c8ee94abf466ceca4f9e895ee09efa0797518bb1b3d51401954c8315ee6c83952b70b6be94f9ceaed03be37db9be5e29972219e8a
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 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.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ ## Installation
2
+
3
+ Добавьте в Gemfile:
4
+
5
+ gem 'yandex-delivery-api', github: 'osetrov/yandex-delivery-api'
6
+
7
+ и запустите `bundle install`.
8
+
9
+ Затем:
10
+
11
+ rails g yandex_delivery:install
12
+
13
+ в файл `config/yandex_delivery.yml` вставьте ваши данные из настоек яндекс доставки:
14
+
15
+ https://delivery.yandex.ru/integration/index
16
+
17
+ Все возможные запросы:
18
+ https://tech.yandex.ru/delivery/doc/dg/about-docpage/
19
+
20
+ Например "Получить варианты доставки":
21
+ ```erb
22
+ params = {
23
+ :city_from => 'Санкт-Петербург',
24
+ :city_to => 'Москва',
25
+ :delivery_type => 'todoor',
26
+ :weight => 2,
27
+ :length => 18,
28
+ :width => 3,
29
+ :height => 3,
30
+ :order_cost => 1000
31
+ }
32
+
33
+ YandexDelivery::get_deliveries params
34
+ ```
35
+
36
+ secret_key, client_id, sender_id указывать в параметрах не обязательно.
@@ -0,0 +1,2 @@
1
+ Description:
2
+ yandex_delivery:install
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ module YandexDelivery
4
+ class InstallGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('templates', __dir__)
6
+
7
+ def generate_install
8
+ copy_file 'yandex_delivery.yml', 'config/yandex_delivery.yml'
9
+ copy_file 'yandex_delivery.rb', 'config/initializers/yandex_delivery.rb'
10
+ end
11
+ end
12
+ end
13
+
@@ -0,0 +1,15 @@
1
+ YandexDelivery.setup do |config|
2
+ if File.exist?('config/yandex_delivery.yml')
3
+ template = ERB.new(File.new('config/yandex_delivery.yml').read)
4
+ processed = YAML.safe_load(template.result(binding))
5
+
6
+ processed['YANDEX_DELIVERY_API_KEY'].each do |k, v|
7
+ config::create_method k.underscore.to_sym
8
+ config::register "#{k.underscore}_key".to_sym, v
9
+ end
10
+
11
+ processed['YANDEX_DELIVERY'].each do |k, v|
12
+ config::register k.underscore.to_sym, v
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,55 @@
1
+ YANDEX_DELIVERY_API_KEY: {
2
+ "getPaymentMethods": "",
3
+ "getSenderOrders": "",
4
+ "getSenderOrderLabel": "",
5
+ "getSenderParcelDocs": "",
6
+ "autocomplete": "",
7
+ "getIndex": "",
8
+ "createOrder": "",
9
+ "updateOrder": "",
10
+ "deleteOrder": "",
11
+ "getSenderOrderStatus": "",
12
+ "getSenderOrderStatuses": "",
13
+ "getSenderInfo": "",
14
+ "getWarehouseInfo": "",
15
+ "getRequisiteInfo": "",
16
+ "getIntervals": "",
17
+ "createWithdraw": "",
18
+ "confirmSenderOrders": "",
19
+ "updateWithdraw": "",
20
+ "createImport": "",
21
+ "updateImport": "",
22
+ "getDeliveries": "",
23
+ "getOrderInfo": "",
24
+ "searchDeliveryList": "",
25
+ "confirmSenderParcels": "",
26
+ "searchSenderOrdersStatuses": "",
27
+ "getImports": "",
28
+ "getWithdraws": "",
29
+ "cancelImport": "",
30
+ "cancelWithdraw": ""
31
+ }
32
+
33
+ YANDEX_DELIVERY: {
34
+ "client": {
35
+ "id": 0
36
+ },
37
+ "warehouses": [
38
+ {
39
+ "id": 0,
40
+ "name": "Склад"
41
+ }
42
+ ],
43
+ "senders": [
44
+ {
45
+ "id": 0,
46
+ "name": "Магазин"
47
+ }
48
+ ],
49
+ "requisites": [
50
+ {
51
+ "id": 0,
52
+ "name": "Рога и Копыта"
53
+ }
54
+ ]
55
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex-delivery-api
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
@@ -30,6 +30,12 @@ executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
+ - LICENSE
34
+ - README.md
35
+ - lib/generators/yandex_delivery/install/USAGE
36
+ - lib/generators/yandex_delivery/install/install_generator.rb
37
+ - lib/generators/yandex_delivery/install/templates/yandex_delivery.rb
38
+ - lib/generators/yandex_delivery/install/templates/yandex_delivery.yml
33
39
  - lib/yandex_delivery.rb
34
40
  homepage: https://github.com/osetrov/yandex-delivery-api
35
41
  licenses: