Skip to content

Commit a30fe2f

Browse files
authored
Merge pull request #19 from ruby-jp/syobocalite_1.1.0
Upgrade to syobocalite 1.1.0
2 parents 7fbda37 + 628a4b8 commit a30fe2f

File tree

3 files changed

+3
-56
lines changed

3 files changed

+3
-56
lines changed

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
77
gem "activesupport", require: "active_support/all"
88
gem "libxml-ruby"
99
gem "mechanize"
10-
gem "multi_xml"
1110
gem "rake", require: false
1211
gem "slack-notifier", ">= 2.4.0"
13-
gem "syobocalite", ">= 1.0.0"
12+
gem "syobocalite", ">= 1.1.0"

Gemfile.lock

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ GEM
5656
rake (13.2.1)
5757
rubyntlm (0.6.3)
5858
slack-notifier (2.4.0)
59-
syobocalite (1.0.1)
59+
syobocalite (1.1.0)
6060
activesupport
6161
multi_xml
6262
tzinfo (2.0.6)
@@ -71,10 +71,9 @@ DEPENDENCIES
7171
activesupport
7272
libxml-ruby
7373
mechanize
74-
multi_xml
7574
rake
7675
slack-notifier (>= 2.4.0)
77-
syobocalite (>= 1.0.0)
76+
syobocalite (>= 1.1.0)
7877

7978
BUNDLED WITH
8079
2.5.3

lib/syobocalite_ext.rb

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
require "open-uri"
2-
31
class Syobocalite::Program
4-
USER_AGENT = "anime_bot (+https://github.com/ruby-jp/anime_bot)"
5-
62
# Slackに投稿するための文言に整形する
73
# @return [String]
84
def format
@@ -35,51 +31,4 @@ def display_flag
3531
str << "【再】" if re_air?
3632
str
3733
end
38-
39-
# 注
40-
def remark?
41-
flag & 0x01 != 0
42-
end
43-
44-
# 新
45-
def new?
46-
flag & 0x02 != 0
47-
end
48-
49-
# 終
50-
def final?
51-
flag & 0x04 != 0
52-
end
53-
54-
# 再
55-
def re_air?
56-
flag & 0x08 != 0
57-
end
58-
59-
private
60-
61-
# @see https://sites.google.com/site/syobocal/spec/proginfo-flag
62-
# @return [Integer]
63-
def flag
64-
@flag ||= get_db_flag
65-
end
66-
67-
# @see https://docs.cal.syoboi.jp/spec/db.php/
68-
# @return [Integer]
69-
def get_db_flag
70-
params = {
71-
"Command" => "ProgLookup",
72-
"Fields" => "Flag",
73-
"TID" => tid,
74-
"PID" => pid,
75-
}
76-
77-
headers = {
78-
"User-Agent" => USER_AGENT,
79-
}
80-
81-
xml = URI.open("https://cal.syoboi.jp/db.php?#{params.to_param}", headers).read
82-
response = MultiXml.parse(xml)
83-
response["ProgLookupResponse"]["ProgItems"]["ProgItem"]["Flag"].to_i
84-
end
8534
end

0 commit comments

Comments
 (0)