webpage_update_checker 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +24 -8
- data/lib/webpage_update_checker/client.rb +13 -3
- data/lib/webpage_update_checker/methods/http_status_code.rb +1 -1
- data/lib/webpage_update_checker/methods/last_modified.rb +1 -1
- data/lib/webpage_update_checker/methods/md5.rb +1 -1
- data/lib/webpage_update_checker/methods/sha1.rb +1 -1
- data/lib/webpage_update_checker/methods/sha256.rb +1 -1
- data/lib/webpage_update_checker/methods/sha384.rb +1 -1
- data/lib/webpage_update_checker/methods/sha512.rb +1 -1
- data/lib/webpage_update_checker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8c2526d9cd437964c3c639911f5f67a47ac66864e6728ca16c5f3369b761bb0
|
4
|
+
data.tar.gz: 18acb4cde3a66373d7ddea4b1175d89b696ca52dc08be62e39a327f535dcdb79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 261c561477dce557e7ea8dcb849ef598040dafa37533dd5ec9a48a77c9ea9039b92adce9cc6cc18429fde9d1b567e8424be76556ad50a820d08209704bdd049b
|
7
|
+
data.tar.gz: eb0d9b21d0ec08687c1eb3b66944569ca01c146bbb26cab94352f5569195fd46c7fb037971078f79ce471d05bd5c0242553a3e619b962dc0b80ecf1c658d9c37
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -7,11 +7,16 @@
|
|
7
7
|
|
8
8
|
# Usage
|
9
9
|
```
|
10
|
-
|
10
|
+
$ vim Gemfile
|
11
|
+
# Add a line
|
12
|
+
# gem 'webpage_update_checker'
|
13
|
+
$ bundle install
|
11
14
|
```
|
12
15
|
|
16
|
+
or
|
17
|
+
|
13
18
|
```bash
|
14
|
-
$
|
19
|
+
$ gem install webpage_update_checker
|
15
20
|
```
|
16
21
|
|
17
22
|
```ruby
|
@@ -20,9 +25,15 @@ require 'webpage_update_checker'
|
|
20
25
|
checker = WebpageUpdateChecker::Client.new
|
21
26
|
target_page_md5 = WebpageUpdateChecker::Methods::Md5.new(uri: 'http://www.ne.jp/asahi/pursuits/ootsuki/pc/X68k/x680x0.xhtml')
|
22
27
|
|
23
|
-
checker.
|
24
|
-
checker.updated?(target_page_md5,
|
25
|
-
checker.updated?(target_page_md5,
|
28
|
+
checker.current_comparison_value(target_page_md5) #=> fb2eeb524e6b5637ef7fa4bed48f1d67
|
29
|
+
checker.updated?(target_page_md5, previous_comparison_value: 'fb2eeb524e6b5637ef7fa4bed48f1d67') #=> false (not updated)
|
30
|
+
checker.updated?(target_page_md5, previous_comparison_value: '12345678901234567890123456789012') #=> true (updated)
|
31
|
+
|
32
|
+
target_page_last_modified = WebpageUpdateChecker::Methods::LastModified.new(uri: 'http://www.ne.jp/asahi/pursuits/ootsuki/pc/X68k/x680x0.xhtml')
|
33
|
+
checker.current_comparison_value(target_page_last_modified) #=> 2008-03-17 16:05:01 +0000
|
34
|
+
|
35
|
+
target_page_http_status_code = WebpageUpdateChecker::Methods::HttpStatusCode.new(uri: 'http://www.ne.jp/asahi/pursuits/ootsuki/pc/X68k/x680x0.xhtml')
|
36
|
+
checker.current_comparison_value(target_page_http_status_code) #=> 200
|
26
37
|
```
|
27
38
|
|
28
39
|
# Methods
|
@@ -39,10 +50,15 @@ You can use these `Methods`.
|
|
39
50
|
# methods
|
40
51
|
You can use these methods in each `Methods`.
|
41
52
|
|
42
|
-
- `#updated?(checked_object,
|
53
|
+
- `#updated?(checked_object, previous_comparison_value:)`
|
43
54
|
- `#=> true or false`
|
44
|
-
- `#
|
45
|
-
- `#=> object such as Time (LastModified)
|
55
|
+
- `#current_comparison_value(checked_object)`
|
56
|
+
- `#=> object such as Time (LastModified), String (MD5, SHA512...) or Integer (HTTP status code)`
|
57
|
+
|
58
|
+
# Note
|
59
|
+
On v1.3.0, the method name that `current_diff_value` was changed to `current_comparison_value` and the keyword argument name that `previous_diff_value` was changed to `previous_comparison_value`.
|
60
|
+
|
61
|
+
So please use `current_comparison_value` method and `previous_comparison_value` keyword argument becuase `current_diff_value` and `previous_diff_value` are deprecated now.
|
46
62
|
|
47
63
|
# TODO
|
48
64
|
- [Coveralls](https://coveralls.io/)
|
@@ -3,12 +3,22 @@ Dir[File.expand_path('methods', __dir__) << '/*.rb'].each { |file| require file
|
|
3
3
|
|
4
4
|
module WebpageUpdateChecker
|
5
5
|
class Client
|
6
|
-
def updated?(checked_object, previous_diff_value:)
|
7
|
-
|
6
|
+
def updated?(checked_object, previous_comparison_value: nil, previous_diff_value: nil)
|
7
|
+
if previous_comparison_value.nil?
|
8
|
+
# Deprecated keyword argument
|
9
|
+
current_comparison_value(checked_object) != previous_diff_value
|
10
|
+
else
|
11
|
+
current_comparison_value(checked_object) != previous_comparison_value
|
12
|
+
end
|
8
13
|
end
|
9
14
|
|
15
|
+
def current_comparison_value(checked_object)
|
16
|
+
checked_object.current_comparison_value
|
17
|
+
end
|
18
|
+
|
19
|
+
# Depricated method
|
10
20
|
def current_diff_value(checked_object)
|
11
|
-
checked_object
|
21
|
+
current_comparison_value(checked_object)
|
12
22
|
end
|
13
23
|
end
|
14
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpage_update_checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Osamu Takiya
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|