syoboi_calendar 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,17 @@
1
1
  module SyoboiCalendar
2
2
  class Client
3
- def channels(options = {})
3
+ # @return [Array<SyoboiCalendar::Resources::Channel>]
4
+ def list_channels(options = {})
4
5
  Processors::Channel.process(options)
5
6
  end
6
7
 
7
- def programs(options = {})
8
+ # @return [Array<SyoboiCalendar::Resources::Program>]
9
+ def list_programs(options = {})
8
10
  Processors::Program.process(options)
9
11
  end
10
12
 
11
- def titles(options = {})
13
+ # @return [Array<SyoboiCalendar::Resources::Title>]
14
+ def list_titles(options = {})
12
15
  Processors::Title.process(options)
13
16
  end
14
17
  end
@@ -8,7 +8,7 @@ module SyoboiCalendar
8
8
  end
9
9
 
10
10
  def items
11
- Array.wrap(response.ChLookupResponse.ChItems.ChItem)
11
+ ::Array.wrap(response.ChLookupResponse.ChItems.ChItem)
12
12
  end
13
13
  end
14
14
  end
@@ -8,7 +8,7 @@ module SyoboiCalendar
8
8
  end
9
9
 
10
10
  def items
11
- Array.wrap(response.ProgLookupResponse.ProgItems.ProgItem)
11
+ ::Array.wrap(response.ProgLookupResponse.ProgItems.ProgItem)
12
12
  end
13
13
  end
14
14
  end
@@ -8,7 +8,7 @@ module SyoboiCalendar
8
8
  end
9
9
 
10
10
  def items
11
- Array.wrap(response.TitleLookupResponse.TitleItems.TitleItem)
11
+ ::Array.wrap(response.TitleLookupResponse.TitleItems.TitleItem)
12
12
  end
13
13
  end
14
14
  end
@@ -36,7 +36,7 @@ module SyoboiCalendar
36
36
  end
37
37
 
38
38
  def includes
39
- Array.wrap(options[:includes])
39
+ ::Array.wrap(options[:includes])
40
40
  end
41
41
  end
42
42
  end
@@ -1,14 +1,17 @@
1
1
  module SyoboiCalendar
2
2
  module Resources
3
3
  class Base
4
+ # @return [Hashie::Mash]
4
5
  attr_reader :response
5
6
 
7
+ # @param response [Hashie::Mash]
6
8
  def initialize(response)
7
9
  @response = response
8
10
  end
9
11
 
12
+ # @return [Time]
10
13
  def updated_at
11
- Time.parse(response.LastUpdate)
14
+ ::Time.parse(response.LastUpdate)
12
15
  end
13
16
  end
14
17
  end
@@ -1,37 +1,45 @@
1
1
  module SyoboiCalendar
2
2
  module Resources
3
3
  class Channel < Base
4
+ # @return [String, nil]
4
5
  def comment
5
6
  response.ChComment
6
7
  end
7
8
 
9
+ # @return [String, nil]
8
10
  def epg_url
9
11
  response.ChEPGURL
10
12
  end
11
13
 
14
+ # @return [Integer, nil]
12
15
  def group_id
13
16
  response.ChGID.try(:to_i)
14
17
  end
15
18
 
19
+ # @return [Integer, nil]
16
20
  def id
17
21
  response.ChID.try(:to_i)
18
22
  end
19
23
 
24
+ # @return [String, nil]
25
+ def iepg_name
26
+ response.ChiEPGName
27
+ end
28
+
29
+ # @return [String, nil]
20
30
  def name
21
31
  response.ChName
22
32
  end
23
33
 
34
+ # @return [Integer, nil]
24
35
  def number
25
36
  response.ChNumber.try(:to_i)
26
37
  end
27
38
 
39
+ # @return [String, nil]
28
40
  def url
29
41
  response.ChURL
30
42
  end
31
-
32
- def iepg_name
33
- response.ChiEPGName
34
- end
35
43
  end
36
44
  end
37
45
  end
@@ -1,55 +1,76 @@
1
1
  module SyoboiCalendar
2
2
  module Resources
3
3
  class Program < Base
4
- attr_accessor :channel, :title
4
+ # @return [SyoboiCalendar::Resources::Channel, nil]
5
+ attr_accessor :channel
5
6
 
6
- def id
7
- response.PID.try(:to_i)
8
- end
9
-
10
- def title_id
11
- response.TID.try(:to_i)
12
- end
7
+ # @return [SyoboiCalendar::Resources::Title, nil]
8
+ attr_accessor :title
13
9
 
14
- def started_at
15
- Time.parse(response.StTime)
10
+ # @return [Integer, nil]
11
+ def channel_id
12
+ response.ChID.try(:to_i)
16
13
  end
17
14
 
18
- def finished_at
19
- Time.parse(response.EdTime)
15
+ # @return [String, nil]
16
+ def comment
17
+ response.ProgComment
20
18
  end
21
19
 
20
+ # @return [Integer, nil]
22
21
  def count
23
22
  response.Count.try(:to_i)
24
23
  end
25
24
 
26
- def sub_title
27
- response.STSubTitle
28
- end
29
-
30
- def comment
31
- response.ProgComment
25
+ # @return [Boolean]
26
+ def deleted?
27
+ response.Deleted != "0"
32
28
  end
33
29
 
30
+ # @return [Integer, nil]
34
31
  def flag
35
32
  response.Flag.try(:to_i)
36
33
  end
37
34
 
38
- def deleted?
39
- response.Deleted != "0"
35
+ # @return [Integer, nil]
36
+ def id
37
+ response.PID.try(:to_i)
40
38
  end
41
39
 
42
- def warn
43
- response.Warn.try(:to_i)
40
+ # @return [String, nil]
41
+ def iepg_name
42
+ response.ChiEPGName
44
43
  end
45
44
 
46
- def channel_id
47
- response.ChID.try(:to_i)
45
+ # @return [Time]
46
+ def finished_at
47
+ ::Time.parse(response.EdTime)
48
48
  end
49
49
 
50
+ # @return [Integer, nil]
50
51
  def revision
51
52
  response.Revision.try(:to_i)
52
53
  end
54
+
55
+ # @return [Time]
56
+ def started_at
57
+ ::Time.parse(response.StTime)
58
+ end
59
+
60
+ # @return [String, nil]
61
+ def sub_title
62
+ response.STSubTitle
63
+ end
64
+
65
+ # @return [Integer]
66
+ def title_id
67
+ response.TID.try(:to_i)
68
+ end
69
+
70
+ # @return [Integer, nil]
71
+ def warn
72
+ response.Warn.try(:to_i)
73
+ end
53
74
  end
54
75
  end
55
76
  end
@@ -1,70 +1,87 @@
1
1
  module SyoboiCalendar
2
2
  module Resources
3
3
  class Title < Base
4
+ # @return [Integer, nil]
4
5
  def category_id
5
6
  response.Cat.try(:to_i)
6
7
  end
7
8
 
9
+ # @return [String, nil]
8
10
  def comment
9
11
  response.Comment
10
12
  end
11
13
 
14
+ # @return [String, nil]
15
+ def english_name
16
+ response.TitleEN
17
+ end
18
+
19
+ # @return [String, nil]
12
20
  def first_channel
13
21
  response.FirstCh
14
22
  end
15
23
 
24
+ # @return [Integer, nil]
16
25
  def first_end_month
17
26
  response.FirstEndMonth.try(:to_i)
18
27
  end
19
28
 
29
+ # @return [Integer, nil]
20
30
  def first_end_year
21
31
  response.FirstEndYear.try(:to_i)
22
32
  end
23
33
 
34
+ # @return [Integer, nil]
24
35
  def first_month
25
36
  response.FirstMonth.try(:to_i)
26
37
  end
27
38
 
39
+ # @return [Integer, nil]
28
40
  def first_year
29
41
  response.FirstYear.try(:to_i)
30
42
  end
31
43
 
32
- def keywords
33
- response.Keywords
34
- end
35
-
36
- def short_title
37
- response.ShortTitle
38
- end
39
-
40
- def sub_titles
41
- response.SubTitles
42
- end
43
-
44
+ # @return [Integer, nil]
44
45
  def id
45
46
  response.TID.try(:to_i)
46
47
  end
47
48
 
49
+ # @return [String, nil]
48
50
  def name
49
51
  response.Title
50
52
  end
51
53
 
52
- def english_name
53
- response.TitleEN
54
- end
55
-
54
+ # @return [Integer, nil]
56
55
  def flag
57
56
  response.TitleFlag.try(:to_i)
58
57
  end
59
58
 
59
+ # @return [String, nil]
60
60
  def kana
61
61
  response.TitleYomi
62
62
  end
63
63
 
64
+ # @return [String, nil]
65
+ def keywords
66
+ response.Keywords
67
+ end
68
+
69
+ # @return [String, nil]
70
+ def short_title
71
+ response.ShortTitle
72
+ end
73
+
74
+ # @return [String, nil]
75
+ def sub_titles
76
+ response.SubTitles
77
+ end
78
+
79
+ # @return [Integer, nil]
64
80
  def point
65
81
  response.UserPoint.try(:to_i)
66
82
  end
67
83
 
84
+ # @return [Integer, nil]
68
85
  def rank
69
86
  response.UserPointRank.try(:to_i)
70
87
  end
@@ -1,3 +1,3 @@
1
1
  module SyoboiCalendar
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,14 +1,5 @@
1
- require "simplecov"
2
- SimpleCov.start
3
-
4
1
  require "webmock/rspec"
5
2
 
6
- if ENV["CI"]
7
- WebMock.disable_net_connect!(allow: "codeclimate.com")
8
- require "codeclimate-test-reporter"
9
- CodeClimate::TestReporter.start
10
- end
11
-
12
3
  require "syoboi_calendar"
13
4
  require "rack"
14
5
  require "active_support/all"