yar 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/Yar/version.rb +1 -1
- data/lib/yar/version.rb +1 -1
- data/yar.gemspec +1 -1
- metadata +1 -16
- data/spec/client_spec.rb +0 -19
- data/spec/lib/resources/carrier_spec.rb +0 -16
- data/spec/lib/resources/copyright_spec.rb +0 -16
- data/spec/lib/resources/nearest_spec.rb +0 -30
- data/spec/lib/resources/schedule_spec.rb +0 -26
- data/spec/lib/resources/stations_spec.rb +0 -26
- data/spec/spec_helper.rb +0 -60
- data/spec/vcr/carrier/schedule.yml +0 -44
- data/spec/vcr/copyright/info.yml +0 -51
- data/spec/vcr/nearest/city.yml +0 -39
- data/spec/vcr/nearest/stations.yml +0 -139
- data/spec/vcr/schedule/between.yml +0 -130
- data/spec/vcr/schedule/schedule.yml +0 -95
- data/spec/vcr/stations/between.yml +0 -130
- data/spec/vcr/stations/schedule.yml +0 -95
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6761bb224ba7edb4489779cc8420ca3253109440bbaa99ef41944079a4f0493
|
4
|
+
data.tar.gz: dd7cdb4cc45403c79e7bff546de0b7d75acfc782b7b3a423dcf3c8cdf490c0e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9086b3f810a0a6c36f4da403bdc054d6e2a7b20ce0900b89e49dde7929d18baec03015517f285c15e216d3eaa23d26ef5f757582b9faef688a51671a26ebd90f
|
7
|
+
data.tar.gz: 846528c02d13bc1bf0d32617bdde71f05c762d96558ebec9a149ef3b3729a0868ada0d6f0e93acaeb3cfbc695ac4dd6918fd66f5fea9563d41a484586c4264ab
|
data/Gemfile.lock
CHANGED
data/lib/Yar/version.rb
CHANGED
data/lib/yar/version.rb
CHANGED
data/yar.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.description = "Yandex.Rasp API wrapper written in Ruby"
|
13
13
|
s.authors = ["Ilya Brin"]
|
14
14
|
s.email = "ilya@codeplay.ru"
|
15
|
-
s.files = `git ls-files
|
15
|
+
s.files = `git ls-files`.split($RS).reject {|fn| fn.start_with? "spec" }
|
16
16
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.homepage = "https://github.com/ruby-api-client/yar"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Brin
|
@@ -177,21 +177,6 @@ files:
|
|
177
177
|
- lib/yar/resources/schedule.rb
|
178
178
|
- lib/yar/resources/stations.rb
|
179
179
|
- lib/yar/version.rb
|
180
|
-
- spec/client_spec.rb
|
181
|
-
- spec/lib/resources/carrier_spec.rb
|
182
|
-
- spec/lib/resources/copyright_spec.rb
|
183
|
-
- spec/lib/resources/nearest_spec.rb
|
184
|
-
- spec/lib/resources/schedule_spec.rb
|
185
|
-
- spec/lib/resources/stations_spec.rb
|
186
|
-
- spec/spec_helper.rb
|
187
|
-
- spec/vcr/carrier/schedule.yml
|
188
|
-
- spec/vcr/copyright/info.yml
|
189
|
-
- spec/vcr/nearest/city.yml
|
190
|
-
- spec/vcr/nearest/stations.yml
|
191
|
-
- spec/vcr/schedule/between.yml
|
192
|
-
- spec/vcr/schedule/schedule.yml
|
193
|
-
- spec/vcr/stations/between.yml
|
194
|
-
- spec/vcr/stations/schedule.yml
|
195
180
|
- yar.gemspec
|
196
181
|
homepage: https://github.com/ruby-api-client/yar
|
197
182
|
licenses:
|
data/spec/client_spec.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe Yar::Client do
|
4
|
-
subject(:client) { described_class.new token: "TOKEN" }
|
5
|
-
|
6
|
-
context "with default format" do
|
7
|
-
it { expect(client).to be_an Yar::Client }
|
8
|
-
it { expect(client.format).to eq "json" }
|
9
|
-
end
|
10
|
-
|
11
|
-
context "with format XML" do
|
12
|
-
subject(:client) { described_class.new token: "TOKEN", format: "xml" }
|
13
|
-
it { expect(client.format).to eq "xml" }
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "VERSION" do
|
17
|
-
it { expect(Yar::VERSION).to eq "1.0.2" }
|
18
|
-
end
|
19
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
require "yar"
|
5
|
-
|
6
|
-
RSpec.describe "#carrier" do
|
7
|
-
describe ".info" do
|
8
|
-
subject(:resp) do
|
9
|
-
VCR.use_cassette("carrier/schedule") do
|
10
|
-
@yar.carrier.info code: "TK", system: "iata"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it { expect(resp).to be_an Yar::Carrier }
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
require "yar"
|
5
|
-
|
6
|
-
RSpec.describe "#copyright" do
|
7
|
-
describe ".info" do
|
8
|
-
subject(:resp) do
|
9
|
-
VCR.use_cassette("copyright/info") do
|
10
|
-
@yar.copyright.info
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it { expect(resp).to be_an Yar::Copyright }
|
15
|
-
end
|
16
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
require "yar"
|
5
|
-
|
6
|
-
RSpec.describe "#nearest" do
|
7
|
-
let(:lat) { 55.733970 }
|
8
|
-
let(:long) { 37.586780 }
|
9
|
-
|
10
|
-
describe ".stations" do
|
11
|
-
subject(:resp) do
|
12
|
-
VCR.use_cassette("nearest/stations") do
|
13
|
-
@yar.nearest.stations lat: 55.733970, long: 37.586780, distance: 10
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it { expect(resp).to be_an Yar::Collection }
|
18
|
-
it { expect(resp.data.first).to be_an Yar::Station }
|
19
|
-
end
|
20
|
-
|
21
|
-
describe ".city" do
|
22
|
-
subject(:resp) do
|
23
|
-
VCR.use_cassette("nearest/city") do
|
24
|
-
@yar.nearest.city(lat: lat, long: long)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it { expect(resp).to be_an Yar::City }
|
29
|
-
end
|
30
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
require "yar"
|
5
|
-
|
6
|
-
RSpec.describe "#schedule" do
|
7
|
-
describe ".info" do
|
8
|
-
subject(:resp) do
|
9
|
-
VCR.use_cassette("schedule/schedule") do
|
10
|
-
@yar.schedule.info station: "s9848585"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it { expect(resp).to be_an Yar::Schedule }
|
15
|
-
end
|
16
|
-
|
17
|
-
describe ".between" do
|
18
|
-
subject(:resp) do
|
19
|
-
VCR.use_cassette("schedule/between") do
|
20
|
-
@yar.schedule.between from: "s9848585", to: "s9848577"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
it { expect(resp).to be_an Yar::Schedule }
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
require "yar"
|
5
|
-
|
6
|
-
RSpec.describe "#stations" do
|
7
|
-
describe ".schedule" do
|
8
|
-
subject(:resp) do
|
9
|
-
VCR.use_cassette("stations/schedule") do
|
10
|
-
@yar.stations.schedule station: "s9848585"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it { expect(resp).to be_an Yar::Schedule }
|
15
|
-
end
|
16
|
-
|
17
|
-
describe ".between" do
|
18
|
-
subject(:resp) do
|
19
|
-
VCR.use_cassette("stations/between") do
|
20
|
-
@yar.stations.between from: "s9848585", to: "s9848577"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
it { expect(resp).to be_an Yar::Schedule }
|
25
|
-
end
|
26
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "simplecov"
|
5
|
-
require "simplecov-lcov"
|
6
|
-
require "webmock/rspec"
|
7
|
-
require "vcr"
|
8
|
-
|
9
|
-
require "yar"
|
10
|
-
|
11
|
-
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
|
12
|
-
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
|
13
|
-
|
14
|
-
SimpleCov.start do
|
15
|
-
add_filter "spec/"
|
16
|
-
add_group "Lib", "lib"
|
17
|
-
minimum_coverage 80.0
|
18
|
-
end
|
19
|
-
|
20
|
-
ACCESS_TOKEN = ENV["YAR_ACCESS_TOKEN"] || "SECRET_TOKEN"
|
21
|
-
|
22
|
-
RSpec.configure do |config|
|
23
|
-
config.before(:each) do
|
24
|
-
@yar = Yar::Client.new(token: ACCESS_TOKEN)
|
25
|
-
end
|
26
|
-
|
27
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
28
|
-
config.disable_monkey_patching!
|
29
|
-
|
30
|
-
config.expect_with :rspec do |c|
|
31
|
-
c.syntax = :expect
|
32
|
-
c.include_chain_clauses_in_custom_matcher_descriptions = true
|
33
|
-
end
|
34
|
-
|
35
|
-
config.mock_with :rspec do |mocks|
|
36
|
-
mocks.verify_partial_doubles = true
|
37
|
-
end
|
38
|
-
config.shared_context_metadata_behavior = :apply_to_host_groups
|
39
|
-
end
|
40
|
-
|
41
|
-
VCR.configure do |c|
|
42
|
-
c.before_record do |i|
|
43
|
-
i.response.body.force_encoding("UTF-8")
|
44
|
-
end
|
45
|
-
|
46
|
-
c.ignore_localhost = true
|
47
|
-
c.cassette_library_dir = "spec/vcr"
|
48
|
-
c.hook_into :webmock
|
49
|
-
|
50
|
-
c.default_cassette_options = {
|
51
|
-
decode_compressed_response: true,
|
52
|
-
allow_unused_http_interactions: false
|
53
|
-
}
|
54
|
-
|
55
|
-
c.filter_sensitive_data("TOKEN") do |i|
|
56
|
-
i.request["headers"]["Authorization"].first
|
57
|
-
end
|
58
|
-
|
59
|
-
c.configure_rspec_metadata!
|
60
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://api.rasp.yandex.net/v3.0/carrier/?code=TK&system=iata
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Faraday v1.10.2
|
12
|
-
Authorization:
|
13
|
-
- TOKEN
|
14
|
-
Accept-Encoding:
|
15
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
-
Accept:
|
17
|
-
- "*/*"
|
18
|
-
response:
|
19
|
-
status:
|
20
|
-
code: 200
|
21
|
-
message: OK
|
22
|
-
headers:
|
23
|
-
Allow:
|
24
|
-
- GET
|
25
|
-
Content-Length:
|
26
|
-
- '311'
|
27
|
-
Content-Type:
|
28
|
-
- application/json; charset=utf-8
|
29
|
-
Date:
|
30
|
-
- Sun, 23 Oct 2022 08:29:12 GMT
|
31
|
-
Vary:
|
32
|
-
- Accept, Accept-Encoding
|
33
|
-
X-Content-Type-Options:
|
34
|
-
- nosniff
|
35
|
-
body:
|
36
|
-
encoding: UTF-8
|
37
|
-
string: '{"carriers":[{"code":5483,"title":"AnadoluJet","codes":{"sirena":null,"iata":"TK","icao":"AJA"},"address":"Bakırköy/
|
38
|
-
İstanbul","url":"http://www.anadolujet.com/","email":"musteri@anadolujet.com","contacts":"","phone":"444
|
39
|
-
25 38","logo":"https://yastat.net/s3/rasp/media/data/company/logo/anadolujet.png","offices":[]},{"code":680,"title":"Turkish
|
40
|
-
Airlines","codes":{"sirena":null,"iata":"TK","icao":"THY"},"address":"Bakırköy/
|
41
|
-
İstanbul","url":"http://www.turkishairlines.com/","email":"","contacts":"","phone":"444
|
42
|
-
08 49","logo":"https://yastat.net/s3/rasp/media/data/company/logo/thy_kopya.jpg","offices":[]}]}'
|
43
|
-
recorded_at: Sun, 23 Oct 2022 08:29:12 GMT
|
44
|
-
recorded_with: VCR 6.1.0
|
data/spec/vcr/copyright/info.yml
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://api.rasp.yandex.net/v3.0/copyright/
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Faraday v1.10.2
|
12
|
-
Authorization:
|
13
|
-
- TOKEN
|
14
|
-
Accept-Encoding:
|
15
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
-
Accept:
|
17
|
-
- "*/*"
|
18
|
-
response:
|
19
|
-
status:
|
20
|
-
code: 200
|
21
|
-
message: OK
|
22
|
-
headers:
|
23
|
-
Allow:
|
24
|
-
- GET
|
25
|
-
Content-Length:
|
26
|
-
- '338'
|
27
|
-
Content-Type:
|
28
|
-
- application/json; charset=utf-8
|
29
|
-
Date:
|
30
|
-
- Sun, 23 Oct 2022 08:29:12 GMT
|
31
|
-
Vary:
|
32
|
-
- Accept, Accept-Encoding
|
33
|
-
X-Content-Type-Options:
|
34
|
-
- nosniff
|
35
|
-
body:
|
36
|
-
encoding: UTF-8
|
37
|
-
string: '{"copyright":{"text":"Данные предоставлены сервисом Яндекс.Расписания","url":"http://rasp.yandex.ru/","logo_vy":"<iframe
|
38
|
-
frameborder=\"0\" style=\"overflow: hidden; border: 0; width: 240px; height:
|
39
|
-
130px;\" src=\"//yandex.st/rasp/media/apicc/copyright_vert_yellow.html\"></iframe>","logo_vm":"<iframe
|
40
|
-
frameborder=\"0\" style=\"overflow: hidden; border: 0; width: 240px; height:
|
41
|
-
130px;\" src=\"//yandex.st/rasp/media/apicc/copyright_vert_mono.html\"></iframe>","logo_vd":"<iframe
|
42
|
-
frameborder=\"0\" style=\"overflow: hidden; border: 0; width: 240px; height:
|
43
|
-
130px;\" src=\"//yandex.st/rasp/media/apicc/copyright_vert_dark.html\"></iframe>","logo_hy":"<iframe
|
44
|
-
frameborder=\"0\" style=\"overflow: hidden; border: 0; width: 740px; height:
|
45
|
-
51px;\" src=\"//yandex.st/rasp/media/apicc/copyright_horiz_yellow.html\"></iframe>","logo_hm":"<iframe
|
46
|
-
frameborder=\"0\" style=\"overflow: hidden; border: 0; width: 740px; height:
|
47
|
-
51px;\" src=\"//yandex.st/rasp/media/apicc/copyright_horiz_mono.html\"></iframe>","logo_hd":"<iframe
|
48
|
-
frameborder=\"0\" style=\"overflow: hidden; border: 0; width: 740px; height:
|
49
|
-
51px;\" src=\"//yandex.st/rasp/media/apicc/copyright_horiz_dark.html\"></iframe>"}}'
|
50
|
-
recorded_at: Sun, 23 Oct 2022 08:29:12 GMT
|
51
|
-
recorded_with: VCR 6.1.0
|
data/spec/vcr/nearest/city.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://api.rasp.yandex.net/v3.0/nearest_settlement/?lat=55.73397&lng=37.58678
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Faraday v1.10.2
|
12
|
-
Authorization:
|
13
|
-
- TOKEN
|
14
|
-
Accept-Encoding:
|
15
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
-
Accept:
|
17
|
-
- "*/*"
|
18
|
-
response:
|
19
|
-
status:
|
20
|
-
code: 200
|
21
|
-
message: OK
|
22
|
-
headers:
|
23
|
-
Allow:
|
24
|
-
- GET
|
25
|
-
Content-Length:
|
26
|
-
- '179'
|
27
|
-
Content-Type:
|
28
|
-
- application/json; charset=utf-8
|
29
|
-
Date:
|
30
|
-
- Sun, 23 Oct 2022 08:29:13 GMT
|
31
|
-
Vary:
|
32
|
-
- Accept
|
33
|
-
X-Content-Type-Options:
|
34
|
-
- nosniff
|
35
|
-
body:
|
36
|
-
encoding: UTF-8
|
37
|
-
string: '{"type":"settlement","title":"Москва","short_title":"Москва","popular_title":"Москва","code":"c213","lat":55.753676,"lng":37.619899,"distance":3.016378011063095}'
|
38
|
-
recorded_at: Sun, 23 Oct 2022 08:29:13 GMT
|
39
|
-
recorded_with: VCR 6.1.0
|