ttsttb 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +6 -0
- data/.rubocop.yml +5 -0
- data/Gemfile.lock +8 -0
- data/README.md +12 -1
- data/lib/ttsttb/version.rb +1 -1
- data/lib/ttsttb.rb +15 -15
- data/ttsttb.gemspec +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: c47b3a5446b1d79df9a55e7e520350d366148e3cd36b3ea42e685d183cb58495
|
4
|
+
data.tar.gz: 76c882d413f2c462d25b9343fd16b1d16c7b557ec79e911c9871cc2211a2d928
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb5f9e8afb24ab090fce465538d6049efcc7ec2855d461deaf2b2362a30da389713f5ec156b86a999220f21e706b0e44e2e49455b6675f0db8cd9890578ccb8e
|
7
|
+
data.tar.gz: 30adf01d45c97ade98b24d5130a5460d8d1182a6e4457c3dcb65a8996695d8ac9dd9f3667eedaa25027396406cfeced5248a0b6fe5a2ef9a0790d1571f38ba52
|
data/.github/workflows/ruby.yml
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -9,6 +9,7 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
11
|
diff-lcs (1.4.4)
|
12
|
+
docile (1.4.0)
|
12
13
|
mini_portile2 (2.6.1)
|
13
14
|
nokogiri (1.12.5)
|
14
15
|
mini_portile2 (~> 2.6.1)
|
@@ -46,6 +47,12 @@ GEM
|
|
46
47
|
rubocop-ast (1.12.0)
|
47
48
|
parser (>= 3.0.1.1)
|
48
49
|
ruby-progressbar (1.11.0)
|
50
|
+
simplecov (0.21.2)
|
51
|
+
docile (~> 1.1)
|
52
|
+
simplecov-html (~> 0.11)
|
53
|
+
simplecov_json_formatter (~> 0.1)
|
54
|
+
simplecov-html (0.12.3)
|
55
|
+
simplecov_json_formatter (0.1.3)
|
49
56
|
unicode-display_width (2.1.0)
|
50
57
|
|
51
58
|
PLATFORMS
|
@@ -56,6 +63,7 @@ DEPENDENCIES
|
|
56
63
|
rake (~> 13.0)
|
57
64
|
rspec
|
58
65
|
rubocop
|
66
|
+
simplecov
|
59
67
|
ttsttb!
|
60
68
|
|
61
69
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -231,13 +231,24 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
|
|
231
231
|
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
232
232
|
|
233
233
|
|
234
|
-
|
234
|
+
### Tests
|
235
235
|
|
236
236
|
|
237
237
|
```
|
238
238
|
% bundle exec rspec
|
239
239
|
```
|
240
240
|
|
241
|
+
### Publis a new version
|
242
|
+
|
243
|
+
Create a tag to be released and push to the github reopsitory. Github actions workflow proceeds ruby gem publish process.
|
244
|
+
```
|
245
|
+
% git switch master
|
246
|
+
% vim lib/ttsttb/version.rb
|
247
|
+
% git commit lib/ttsttb/version.rb -m 'bump version'
|
248
|
+
% git tag <v0.0.0>
|
249
|
+
% git push --tags
|
250
|
+
```
|
251
|
+
|
241
252
|
|
242
253
|
## Contributing
|
243
254
|
|
data/lib/ttsttb/version.rb
CHANGED
data/lib/ttsttb.rb
CHANGED
@@ -10,26 +10,26 @@ module Ttsttb
|
|
10
10
|
# TODO
|
11
11
|
raise 'Today is not supported yet.' if date == Date.today
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
raise 'Data is not found on the MUFG page corresponding to the specificate date.'
|
18
|
-
end
|
13
|
+
raise 'Old data before 1990/1/1 is not provided.' if date < Date.new(1990, 1, 1)
|
14
|
+
|
15
|
+
doc = Nokogiri::HTML(html(date))
|
16
|
+
scrape(doc)
|
19
17
|
end
|
20
18
|
|
21
|
-
def self.
|
19
|
+
def self.html(date)
|
22
20
|
url = format('http://www.murc-kawasesouba.jp/fx/past/index.php?id=%<ymd>s',
|
23
21
|
{ :ymd => date.strftime('%y%m%d') })
|
24
|
-
|
25
|
-
url
|
22
|
+
|
23
|
+
URI.open(url, :redirect => false).read.encode('utf-8')
|
26
24
|
rescue OpenURI::HTTPRedirect
|
27
|
-
format('http://www.murc-kawasesouba.jp/fx/past_3month_result.php?y=%<y>s&m=%<m>s&d=%<d>s&c=',
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
url = format('http://www.murc-kawasesouba.jp/fx/past_3month_result.php?y=%<y>s&m=%<m>s&d=%<d>s&c=',
|
26
|
+
{
|
27
|
+
:y => date.strftime('%Y'),
|
28
|
+
:m => date.strftime('%m'),
|
29
|
+
:d => date.strftime('%d')
|
30
|
+
})
|
31
|
+
|
32
|
+
URI.open(url, :redirect => false).read.encode('utf-8')
|
33
33
|
end
|
34
34
|
|
35
35
|
# parse document
|
data/ttsttb.gemspec
CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency "rake", "~> 13.0"
|
34
34
|
spec.add_development_dependency "rspec"
|
35
35
|
spec.add_development_dependency "rubocop"
|
36
|
+
spec.add_development_dependency 'simplecov'
|
36
37
|
|
37
38
|
spec.add_runtime_dependency 'nokogiri'
|
38
39
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ttsttb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuki Matsukura
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: nokogiri
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|