rail-locator-api 0.1.3 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +41 -1
- data/lib/rail-locator-api/api_request.rb +1 -1
- data/lib/rail-locator-api/version.rb +1 -1
- data/lib/rail-locator-api.rb +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd9b0658d02439340c1357986bf4b74d8ba36ccf495e71cff5dbb81020e8c186
|
4
|
+
data.tar.gz: 80fc9b7fc56d3fb8903d4aa187f984b52c24b8e173880b130848261068559e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 429006dfda86fcc5645f22796fd4e9f2e5f81c00d4fb31748c6544a52050a9f3a105b82bb4edb8adf71879e51c1a7bb8b83774dd2a404f0af01a948c83be5f91
|
7
|
+
data.tar.gz: 7e4700cb44aa1ae7b264538d61ecc8600ecd00c58968af6268bfd656081701d91f0e1d4ff7fdd11e8bfbaffd5151f374d8cd526104b098f763c324fb81b197d3
|
data/README.markdown
CHANGED
@@ -43,10 +43,14 @@ API wrapper для RailLocator API v2
|
|
43
43
|
8. [Справочники](#references)
|
44
44
|
1. [Получение Координат Станции](#references_station_get)
|
45
45
|
2. [Получение Списка Станций С Краткой Информацией](#references_stations_get)
|
46
|
+
9. [Рассылки](#emailings)
|
47
|
+
1. [Создание Рассылки](#emailings_post)
|
46
48
|
|
47
49
|
# <a name="install"></a> Установка
|
48
50
|
|
49
51
|
Для авторизации по api key необходимо получить его [в личном кабинете локатора](https://rail-locator.com/app/api-keys)
|
52
|
+
или в телеграм боте [@RailLocatorApiBot](https://t.me/RailLocatorApiBot)
|
53
|
+
|
50
54
|
либо использовать другие методы авторизации:
|
51
55
|
|
52
56
|
`:keycloak, :api_key, :base64`
|
@@ -499,4 +503,40 @@ p response.body
|
|
499
503
|
```ruby
|
500
504
|
response = RailLocatorApi::Request.references.stations.retrieve(params: {station_code: "111"})
|
501
505
|
p response.body
|
502
|
-
```
|
506
|
+
```
|
507
|
+
## <a name="emailings"></a> Рассылки
|
508
|
+
### <a name="emailings_post"></a> [Создание Рассылки](http://soap.ctm.ru:8112/api/v2.0/redoc#tag/Rassylki/operation/__________________emailings_post)
|
509
|
+
|
510
|
+
```ruby
|
511
|
+
request = {
|
512
|
+
"title": "Название рассылки",
|
513
|
+
"data_source": "groups",
|
514
|
+
"data_ids": [
|
515
|
+
"1234",
|
516
|
+
"12345"
|
517
|
+
],
|
518
|
+
"recipients": [
|
519
|
+
"example@mail.ru"
|
520
|
+
],
|
521
|
+
"sending_days": [
|
522
|
+
"Sun",
|
523
|
+
"Mon",
|
524
|
+
"Tue",
|
525
|
+
"Wed",
|
526
|
+
"Thu",
|
527
|
+
"Fri",
|
528
|
+
"Sat"
|
529
|
+
],
|
530
|
+
"sending_times": [
|
531
|
+
"08:00:00",
|
532
|
+
"17:00:00"
|
533
|
+
],
|
534
|
+
"template_title": "Тема письма",
|
535
|
+
"template_content": "Текст письма",
|
536
|
+
"active_objects": true,
|
537
|
+
"language": "ru",
|
538
|
+
"user_note": "Примечание"
|
539
|
+
}
|
540
|
+
response = RailLocatorApi::Request.emailings.create(body: request)
|
541
|
+
p response.body
|
542
|
+
```
|
@@ -134,7 +134,6 @@ module RailLocatorApi
|
|
134
134
|
if @request_builder.without_ratelimit
|
135
135
|
request.headers['X-Request-Without-Ratelimit'] = "1"
|
136
136
|
end
|
137
|
-
|
138
137
|
request.headers.merge!(headers) if headers
|
139
138
|
request.body = MultiJson.dump(body) if body
|
140
139
|
request.options.timeout = self.timeout
|
@@ -145,6 +144,7 @@ module RailLocatorApi
|
|
145
144
|
def rest_client(suffix=nil)
|
146
145
|
client = Faraday.new("#{self.api_url}#{suffix.present? ? "/#{suffix}": ""}", proxy: self.proxy,
|
147
146
|
ssl: { version: self.ssl_options }) do |faraday|
|
147
|
+
faraday.use :gzip
|
148
148
|
faraday.response :raise_error
|
149
149
|
faraday.adapter adapter
|
150
150
|
if @request_builder.debug
|
data/lib/rail-locator-api.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rail-locator-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Osetrov
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.16.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday-gzip
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: multi_json
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|