bestchange 1.1 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/README.md +5 -5
- data/bestchange.gemspec +39 -0
- data/lib/bestchange/api.rb +4 -12
- data/lib/bestchange/version.rb +1 -1
- data/lib/bestchange/zip_extractor.rb +3 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d6a02d56b4b2a21310cec76c34b7b35565953193839cd881e601a8793713da9
|
4
|
+
data.tar.gz: 79f74ffaad6279e4786bf0feb0c6adf0cf2cde65ae219a4831290460aa0b968f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9390b359cafddf3c1f1cda493f47a0e6a3723575dc049b4e1f037795677d2f474d93163195e8e0c9ea56ec78c88d5b976c5bc315640aef2261440879cb7e6f54
|
7
|
+
data.tar.gz: 0f0b6ba210438209fddbece962396ecc7336c48b509d834e974fc0ff1ec0049260258294e5655d1514f1bae42746f5e357aeec223cbf3b8f1f3e3966d545229e
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bestchange
|
4
|
+
bestchange (1.3)
|
5
5
|
rubyzip (= 2.3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -48,7 +48,7 @@ PLATFORMS
|
|
48
48
|
arm64-darwin-22
|
49
49
|
|
50
50
|
DEPENDENCIES
|
51
|
-
bestchange
|
51
|
+
bestchange!
|
52
52
|
minitest (= 5.17.0)
|
53
53
|
minitest-reporters
|
54
54
|
pry (= 0.14.2)
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
|
2
|
-
# bestchange
|
2
|
+
# bestchange
|
3
3
|
|
4
|
-
bestchange
|
4
|
+
bestchange is a simple library for getting data from Bestchange aggregator
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
8
|
Add this line to your application's Gemfile:
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
gem 'bestchange
|
11
|
+
gem 'bestchange'
|
12
12
|
```
|
13
13
|
|
14
14
|
And then execute:
|
@@ -17,7 +17,7 @@ And then execute:
|
|
17
17
|
|
18
18
|
Or install it yourself as:
|
19
19
|
|
20
|
-
$ gem install bestchange
|
20
|
+
$ gem install bestchange
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
[Bestchange api description](https://github.com/karpinovsky/bestchange-api/blob/master/API_DOC.txt)
|
@@ -83,4 +83,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
83
83
|
|
84
84
|
## Code of Conduct
|
85
85
|
|
86
|
-
Everyone interacting in the bestchange
|
86
|
+
Everyone interacting in the bestchange project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/karpinovsky/bestchange-api/blob/master/CODE_OF_CONDUCT.md).
|
data/bestchange.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/bestchange/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'bestchange'
|
7
|
+
spec.summary = 'Bestchange client'
|
8
|
+
spec.description = 'A simple library for getting data from Bestchange aggregator'
|
9
|
+
|
10
|
+
spec.version = Bestchange::VERSION
|
11
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.1.3')
|
12
|
+
|
13
|
+
spec.authors = ['Kirill Karpinovsky']
|
14
|
+
spec.email = 'karpinovsky@gmail.com'
|
15
|
+
|
16
|
+
spec.homepage = 'https://github.com/karpinovsky/bestchange'
|
17
|
+
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
20
|
+
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
|
21
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
22
|
+
|
23
|
+
spec.extra_rdoc_files = Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt']
|
24
|
+
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
|
29
|
+
spec.require_paths = ['lib']
|
30
|
+
|
31
|
+
spec.add_dependency 'rubyzip', '2.3.2'
|
32
|
+
|
33
|
+
spec.add_development_dependency 'minitest', '5.17.0'
|
34
|
+
spec.add_development_dependency 'minitest-reporters'
|
35
|
+
spec.add_development_dependency 'pry', '0.14.2'
|
36
|
+
spec.add_development_dependency 'rubocop', '1.47.0'
|
37
|
+
|
38
|
+
spec.license = 'MIT'
|
39
|
+
end
|
data/lib/bestchange/api.rb
CHANGED
@@ -9,25 +9,17 @@ require 'zip'
|
|
9
9
|
module Bestchange
|
10
10
|
class Api
|
11
11
|
BASE_URI = 'http://api.bestchange.ru/info.zip'
|
12
|
+
BASE_CONNECTION = Net::HTTP.new(URI(BASE_URI).host, URI(BASE_URI).port)
|
13
|
+
BASE_REQUEST = Net::HTTP::Get.new(URI(BASE_URI))
|
12
14
|
|
13
|
-
def initialize(conn =
|
15
|
+
def initialize(conn = BASE_CONNECTION)
|
14
16
|
@conn = conn
|
15
17
|
end
|
16
18
|
|
17
19
|
attr_reader :conn
|
18
20
|
|
19
|
-
def request(request =
|
21
|
+
def request(request = BASE_REQUEST)
|
20
22
|
conn.request(request)
|
21
23
|
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def default_conn
|
26
|
-
Net::HTTP.new(URI(BASE_URI).host, URI(BASE_URI).port)
|
27
|
-
end
|
28
|
-
|
29
|
-
def default_request
|
30
|
-
Net::HTTP::Get.new(URI(BASE_URI))
|
31
|
-
end
|
32
24
|
end
|
33
25
|
end
|
data/lib/bestchange/version.rb
CHANGED
@@ -4,8 +4,9 @@ require 'zip'
|
|
4
4
|
|
5
5
|
module Bestchange
|
6
6
|
class ZipExtractor
|
7
|
-
def initialize(zip_file)
|
7
|
+
def initialize(zip_file, on_extract: nil)
|
8
8
|
@zip_file = zip_file
|
9
|
+
@on_extract = on_extract
|
9
10
|
end
|
10
11
|
|
11
12
|
def call(filename)
|
@@ -14,6 +15,7 @@ module Bestchange
|
|
14
15
|
Zip::File.open(@zip_file) do |zip_file|
|
15
16
|
entry = zip_file.find_entry(filename)
|
16
17
|
|
18
|
+
@on_extract&.call(entry)
|
17
19
|
entry.extract(tempfile) { true }
|
18
20
|
end
|
19
21
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bestchange
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Karpinovsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- LICENSE
|
99
99
|
- README.md
|
100
100
|
- Rakefile
|
101
|
+
- bestchange.gemspec
|
101
102
|
- bin/console
|
102
103
|
- bin/setup
|
103
104
|
- lib/bestchange.rb
|