sayanoyudokoro 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +1 -0
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +57 -0
- data/README.md +35 -0
- data/Rakefile +8 -0
- data/lib/sayanoyudokoro/congestion.rb +41 -0
- data/lib/sayanoyudokoro/version.rb +5 -0
- data/lib/sayanoyudokoro.rb +9 -0
- data/sayanoyudokoro.gemspec +38 -0
- data/sig/sayanoyudokoro.rbs +4 -0
- metadata +60 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5abe5b48e0c40e6af9fa7fdc64f680b43a4ea8a1fa1b49a0360920996df73b5e
|
4
|
+
data.tar.gz: fac9e14cd22f1edaf05224d43cd18071998a459b75e03ac56b41c49edcdc5fb6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a4516ff910a0e5d9f5b96468ecc86e04e1f3c195d4bdea940e5a38614b4c0d44df136806636e0e33114293e39d81ab2ef15536f6953d20abbc5c8b84ec47a28e
|
7
|
+
data.tar.gz: 84b3797b801eb51c86e3f4565c77610419935950c673fd05563fb9fc95d02341f52a588c4cce1e972b9411169367efcf152776565050dfc5fba8d123caabe2d9
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
sayanoyudokoro (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
diff-lcs (1.5.0)
|
11
|
+
json (2.6.3)
|
12
|
+
parallel (1.22.1)
|
13
|
+
parser (3.2.0.0)
|
14
|
+
ast (~> 2.4.1)
|
15
|
+
rainbow (3.1.1)
|
16
|
+
rake (13.0.6)
|
17
|
+
regexp_parser (2.6.1)
|
18
|
+
rexml (3.2.5)
|
19
|
+
rspec (3.12.0)
|
20
|
+
rspec-core (~> 3.12.0)
|
21
|
+
rspec-expectations (~> 3.12.0)
|
22
|
+
rspec-mocks (~> 3.12.0)
|
23
|
+
rspec-core (3.12.0)
|
24
|
+
rspec-support (~> 3.12.0)
|
25
|
+
rspec-expectations (3.12.2)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.12.0)
|
28
|
+
rspec-mocks (3.12.3)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.12.0)
|
31
|
+
rspec-support (3.12.0)
|
32
|
+
rubocop (1.43.0)
|
33
|
+
json (~> 2.3)
|
34
|
+
parallel (~> 1.10)
|
35
|
+
parser (>= 3.2.0.0)
|
36
|
+
rainbow (>= 2.2.2, < 4.0)
|
37
|
+
regexp_parser (>= 1.8, < 3.0)
|
38
|
+
rexml (>= 3.2.5, < 4.0)
|
39
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
40
|
+
ruby-progressbar (~> 1.7)
|
41
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
42
|
+
rubocop-ast (1.24.1)
|
43
|
+
parser (>= 3.1.1.0)
|
44
|
+
ruby-progressbar (1.11.0)
|
45
|
+
unicode-display_width (2.4.2)
|
46
|
+
|
47
|
+
PLATFORMS
|
48
|
+
arm64-darwin-21
|
49
|
+
|
50
|
+
DEPENDENCIES
|
51
|
+
rake (~> 13.0)
|
52
|
+
rspec (~> 3.12)
|
53
|
+
rubocop (~> 1.21)
|
54
|
+
sayanoyudokoro!
|
55
|
+
|
56
|
+
BUNDLED WITH
|
57
|
+
2.3.13
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Sayanoyudokoro
|
2
|
+
|
3
|
+
Welcome to sayanoyudokoro gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sayanoyudokoro`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add sayanoyudokoro
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install sayanoyudokoro
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
irb(main):003:0> require 'sayanoyudokoro'
|
22
|
+
=> true
|
23
|
+
irb(main):004:0> Sayanoyudokoro::Congestion.current_status
|
24
|
+
=> {:time=>2023-02-02 14:00:00 +0900, :degree=>3}
|
25
|
+
```
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sayanoyudokoro.
|
data/Rakefile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
module Sayanoyudokoro
|
2
|
+
class Congestion
|
3
|
+
def self.current_status
|
4
|
+
require "open-uri"
|
5
|
+
url = "https://www.sayanoyudokoro.co.jp/"
|
6
|
+
res = URI.open(url)
|
7
|
+
body = res.read
|
8
|
+
|
9
|
+
degree = nil
|
10
|
+
|
11
|
+
# degree
|
12
|
+
if (match = body.match(%r{(https://pbs\.twimg\.com/media/[\w-]+\.png)}))
|
13
|
+
image_url = match[1]
|
14
|
+
|
15
|
+
digest = Digest::SHA1.hexdigest(URI.open(image_url).read.unpack("c*").join)
|
16
|
+
|
17
|
+
degree = 3 if digest == "ad256cae53f7d0f51a3bdd3550858679aea640f8"
|
18
|
+
degree = 2 if digest == "b2024cb98c0a3ae2e195bab05d3e7dfa30122d5d"
|
19
|
+
degree = 1 if digest == "14f6acb99685d227e3cb650cf8a96f99d351ffc9"
|
20
|
+
|
21
|
+
# closed
|
22
|
+
degree = nil if digest == "e7cd3115292c61388e50f3502099b9becd168581"
|
23
|
+
end
|
24
|
+
|
25
|
+
# time
|
26
|
+
time = Time.now
|
27
|
+
if (match = body.match(%r{(\d{4})/(\d{2})/(\d{2}) (\d{2}):(\d{2}):(\d{2})}))
|
28
|
+
time = Time.new(
|
29
|
+
match[1],
|
30
|
+
match[2],
|
31
|
+
match[3],
|
32
|
+
match[4],
|
33
|
+
match[5],
|
34
|
+
match[6]
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
{ time: time, degree: degree }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/sayanoyudokoro/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "sayanoyudokoro"
|
7
|
+
spec.version = Sayanoyudokoro::VERSION
|
8
|
+
spec.authors = ["Yuki Matsukura"]
|
9
|
+
spec.email = ["matsubokkuri@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Scrape Sayano yudokoro official web page and returns degree of congestion."
|
12
|
+
spec.description = "Sayano yudokoro shows the degree of congestion in the hall by the image. It is difficult to use the image to anlyze and record so that this gem covert the image into numeric."
|
13
|
+
spec.homepage = "https://github.com/matsubo/sayanoyudokoro"
|
14
|
+
spec.required_ruby_version = ">= 3.0.0"
|
15
|
+
|
16
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
17
|
+
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/matsubo/sayanoyudokoro"
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/matsubo/sayanoyudokoro"
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
27
|
+
end
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
# Uncomment to register a new dependency of your gem
|
34
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
35
|
+
|
36
|
+
# For more information and examples about making a new gem, check out our
|
37
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sayanoyudokoro
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuki Matsukura
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-02-02 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Sayano yudokoro shows the degree of congestion in the hall by the image.
|
14
|
+
It is difficult to use the image to anlyze and record so that this gem covert the
|
15
|
+
image into numeric.
|
16
|
+
email:
|
17
|
+
- matsubokkuri@gmail.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- ".rspec"
|
23
|
+
- ".rubocop.yml"
|
24
|
+
- CHANGELOG.md
|
25
|
+
- Gemfile
|
26
|
+
- Gemfile.lock
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- lib/sayanoyudokoro.rb
|
30
|
+
- lib/sayanoyudokoro/congestion.rb
|
31
|
+
- lib/sayanoyudokoro/version.rb
|
32
|
+
- sayanoyudokoro.gemspec
|
33
|
+
- sig/sayanoyudokoro.rbs
|
34
|
+
homepage: https://github.com/matsubo/sayanoyudokoro
|
35
|
+
licenses: []
|
36
|
+
metadata:
|
37
|
+
allowed_push_host: https://rubygems.org
|
38
|
+
homepage_uri: https://github.com/matsubo/sayanoyudokoro
|
39
|
+
source_code_uri: https://github.com/matsubo/sayanoyudokoro
|
40
|
+
changelog_uri: https://github.com/matsubo/sayanoyudokoro
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 3.0.0
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubygems_version: 3.3.7
|
57
|
+
signing_key:
|
58
|
+
specification_version: 4
|
59
|
+
summary: Scrape Sayano yudokoro official web page and returns degree of congestion.
|
60
|
+
test_files: []
|