syoboi_calendar 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6198d0d820f2c6005636a48403f17b363a04fb17
4
- data.tar.gz: 0fd21d40332d20febf1fc15403770d35f90ac5d4
3
+ metadata.gz: 5346554a9e8ec0c05a1a7f9b715edd122ab8cce2
4
+ data.tar.gz: 28c95e9429d5626c612476f9386504cadc048e96
5
5
  SHA512:
6
- metadata.gz: 36f9c42cd64d720b59110a884a194c4fbe823e85bd3323e186923e003f65fca566ddfbc1e426f6da758944b99f01cb29b0b4e0b7eaebe981348196b831f52bed
7
- data.tar.gz: 6f6ff38c9e8e939cf0885f43d40ae0522ecf08deb314516ca749364b95221e592e53d36ab31c1559c823f7bfe186e3eb1fff95bc1346059750557ed1a8e33a4f
6
+ metadata.gz: 54c8869860f68a1d928a7bed7bee325c66c700da04a98088cfd24942053942b3ceac230d5d41f8f030bc7a8c8f7906b68d8140ea88963637765cb88beda1cbab
7
+ data.tar.gz: 7c147a0f1b67908fed9cd67ba2aab48daf161050140230e7a8f1f00d973ccd973d51450f9a0ee32f976e6b4971a46ce7c97de9ceaa99936635a1eef56f5add6d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.5.1
2
+
3
+ - Support :title_id options on list_programs method
4
+ - Support :fields option on list_programs and list_titles
5
+ - Support multiple IDs and counts options on client methods
6
+
1
7
  ## 0.5.0
2
8
 
3
9
  - Refactor internal implementation
data/README.md CHANGED
@@ -81,6 +81,12 @@ Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=ProgLookup&JOIN=Su
81
81
  client.list_programs
82
82
  ```
83
83
 
84
+ Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=ProgLookup&JOIN=SubTitles&TID=1`.
85
+
86
+ ```ruby
87
+ client.list_programs(title_id: 1)
88
+ ```
89
+
84
90
  Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=ProgLookup&JOIN=SubTitles&PID=1`.
85
91
 
86
92
  ```ruby
@@ -99,6 +105,12 @@ Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=ProgLookup&Count=1
99
105
  client.list_programs(count: 1)
100
106
  ```
101
107
 
108
+ Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=ProgLookup&Fields=PID&JOIN=SubTitles`.
109
+
110
+ ```ruby
111
+ client.list_programs(fields: ["PID"])
112
+ ```
113
+
102
114
  Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=ProgLookup&JOIN=SubTitles&LastUpdate=20000101_000000-`.
103
115
 
104
116
  ```ruby
@@ -155,7 +167,7 @@ client.list_programs(played_from: Time.new(2000, 1, 1), played_to: Time.new(2000
155
167
 
156
168
  ### SyoboiCalendar::Client#list_titles
157
169
 
158
- Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=TitleLookup`.
170
+ Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=TitleLookup&TID=*`.
159
171
 
160
172
  ```ruby
161
173
  client.list_titles
@@ -167,25 +179,31 @@ Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=TitleLookup&TID=1`
167
179
  client.list_titles(title_id: 1)
168
180
  ```
169
181
 
170
- Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=TitleLookup&LastUpdate=20000101_000000-`.
182
+ Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=TitleLookup&Fields=TID`.
183
+
184
+ ```ruby
185
+ client.list_titles(fields: ["TID"])
186
+ ```
187
+
188
+ Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=TitleLookupp&TID=*&LastUpdate=20000101_000000-`.
171
189
 
172
190
  ```ruby
173
191
  client.list_titles(updated_from: Time.new(2000, 1, 1))
174
192
  ```
175
193
 
176
- Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=TitleLookup&LastUpdate=-20000101_000000`.
194
+ Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=TitleLookupp&TID=*&LastUpdate=-20000101_000000`.
177
195
 
178
196
  ```ruby
179
197
  client.list_titles(updated_to: Time.new(2000, 1, 1))
180
198
  ```
181
199
 
182
- Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=TitleLookup&LastUpdate=20000101_000000-20000201_000000`.
200
+ Sends an HTTP request to `http://cal.syoboi.jp/db.php?Command=TitleLookupp&TID=*&LastUpdate=20000101_000000-20000201_000000`.
183
201
 
184
202
  ```ruby
185
203
  client.list_titles(updated_from: Time.new(2000, 1, 1), updated_to: Time.new(2000, 2, 1))
186
204
  ```
187
205
 
188
- ### SyoboiCalendar::Resources::Channel#comment
206
+ ### SyoboiCalendar::Resources::ChannelResource#comment
189
207
 
190
208
  ```ruby
191
209
  client.list_channels.first.comment
@@ -200,7 +218,7 @@ client.list_channels.first.comment
200
218
 
201
219
  </details>
202
220
 
203
- ### SyoboiCalendar::Resources::Channel#epg_url
221
+ ### SyoboiCalendar::Resources::ChannelResource#epg_url
204
222
 
205
223
  ```ruby
206
224
  client.list_channels.first.epg_url
@@ -215,7 +233,7 @@ client.list_channels.first.epg_url
215
233
 
216
234
  </details>
217
235
 
218
- ### SyoboiCalendar::Resources::Channel#group_id
236
+ ### SyoboiCalendar::Resources::ChannelResource#group_id
219
237
 
220
238
  ```ruby
221
239
  client.list_channels.first.group_id
@@ -230,7 +248,7 @@ client.list_channels.first.group_id
230
248
 
231
249
  </details>
232
250
 
233
- ### SyoboiCalendar::Resources::Channel#id
251
+ ### SyoboiCalendar::Resources::ChannelResource#id
234
252
 
235
253
  ```ruby
236
254
  client.list_channels.first.id
@@ -245,7 +263,7 @@ client.list_channels.first.id
245
263
 
246
264
  </details>
247
265
 
248
- ### SyoboiCalendar::Resources::Channel#iepg_name
266
+ ### SyoboiCalendar::Resources::ChannelResource#iepg_name
249
267
 
250
268
  ```ruby
251
269
  client.list_channels.first.iepg_name
@@ -260,7 +278,7 @@ client.list_channels.first.iepg_name
260
278
 
261
279
  </details>
262
280
 
263
- ### SyoboiCalendar::Resources::Channel#number
281
+ ### SyoboiCalendar::Resources::ChannelResource#number
264
282
 
265
283
  ```ruby
266
284
  client.list_channels.first.number
@@ -275,7 +293,7 @@ client.list_channels.first.number
275
293
 
276
294
  </details>
277
295
 
278
- ### SyoboiCalendar::Resources::Channel#url
296
+ ### SyoboiCalendar::Resources::ChannelResource#url
279
297
 
280
298
  ```ruby
281
299
  client.list_channels.first.url
@@ -290,7 +308,7 @@ client.list_channels.first.url
290
308
 
291
309
  </details>
292
310
 
293
- ### SyoboiCalendar::Resources::Program#channel_id
311
+ ### SyoboiCalendar::Resources::ProgramResource#channel_id
294
312
 
295
313
  ```ruby
296
314
  client.list_programs.first.channel_id
@@ -305,7 +323,7 @@ client.list_programs.first.channel_id
305
323
 
306
324
  </details>
307
325
 
308
- ### SyoboiCalendar::Resources::Program#comment
326
+ ### SyoboiCalendar::Resources::ProgramResource#comment
309
327
 
310
328
  ```ruby
311
329
  client.list_programs[96].comment
@@ -320,7 +338,7 @@ client.list_programs[96].comment
320
338
 
321
339
  </details>
322
340
 
323
- ### SyoboiCalendar::Resources::Program#count
341
+ ### SyoboiCalendar::Resources::ProgramResource#count
324
342
 
325
343
  ```ruby
326
344
  client.list_programs.first.count
@@ -335,7 +353,7 @@ client.list_programs.first.count
335
353
 
336
354
  </details>
337
355
 
338
- ### SyoboiCalendar::Resources::Program#deleted?
356
+ ### SyoboiCalendar::Resources::ProgramResource#deleted?
339
357
 
340
358
  ```ruby
341
359
  client.list_programs.first.count
@@ -350,7 +368,7 @@ false
350
368
 
351
369
  </details>
352
370
 
353
- ### SyoboiCalendar::Resources::Program#finished_at
371
+ ### SyoboiCalendar::Resources::ProgramResource#finished_at
354
372
 
355
373
  ```ruby
356
374
  client.list_programs.first.finished_at.to_s
@@ -365,7 +383,7 @@ client.list_programs.first.finished_at.to_s
365
383
 
366
384
  </details>
367
385
 
368
- ### SyoboiCalendar::Resources::Program#flag
386
+ ### SyoboiCalendar::Resources::ProgramResource#flag
369
387
 
370
388
  ```ruby
371
389
  client.list_programs.first.flag
@@ -380,7 +398,7 @@ client.list_programs.first.flag
380
398
 
381
399
  </details>
382
400
 
383
- ### SyoboiCalendar::Resources::Program#revision
401
+ ### SyoboiCalendar::Resources::ProgramResource#revision
384
402
 
385
403
  ```ruby
386
404
  client.list_programs.first.revision
@@ -395,7 +413,7 @@ client.list_programs.first.revision
395
413
 
396
414
  </details>
397
415
 
398
- ### SyoboiCalendar::Resources::Program#started_at
416
+ ### SyoboiCalendar::Resources::ProgramResource#started_at
399
417
 
400
418
  ```ruby
401
419
  client.list_programs.first.started_at.to_s
@@ -410,7 +428,7 @@ client.list_programs.first.started_at.to_s
410
428
 
411
429
  </details>
412
430
 
413
- ### SyoboiCalendar::Resources::Program#sub_title
431
+ ### SyoboiCalendar::Resources::ProgramResource#sub_title
414
432
 
415
433
  ```ruby
416
434
  client.list_programs.first.sub_title
@@ -425,7 +443,7 @@ client.list_programs.first.sub_title
425
443
 
426
444
  </details>
427
445
 
428
- ### SyoboiCalendar::Resources::Program#title_id
446
+ ### SyoboiCalendar::Resources::ProgramResource#title_id
429
447
 
430
448
  ```ruby
431
449
  client.list_programs.first.title_id
@@ -440,7 +458,7 @@ client.list_programs.first.title_id
440
458
 
441
459
  </details>
442
460
 
443
- ### SyoboiCalendar::Resources::Program#updated_at
461
+ ### SyoboiCalendar::Resources::ProgramResource#updated_at
444
462
 
445
463
  ```ruby
446
464
  client.list_programs.first.updated_at.to_s
@@ -455,7 +473,7 @@ client.list_programs.first.updated_at.to_s
455
473
 
456
474
  </details>
457
475
 
458
- ### SyoboiCalendar::Resources::Program#warn
476
+ ### SyoboiCalendar::Resources::ProgramResource#warn
459
477
 
460
478
  ```ruby
461
479
  client.list_programs.first.warn
@@ -470,7 +488,7 @@ client.list_programs.first.warn
470
488
 
471
489
  </details>
472
490
 
473
- ### SyoboiCalendar::Resources::Title#category_id
491
+ ### SyoboiCalendar::Resources::TitleResource#category_id
474
492
 
475
493
  ```ruby
476
494
  client.list_titles(title_id: 1).first.category_id
@@ -485,7 +503,7 @@ client.list_titles(title_id: 1).first.category_id
485
503
 
486
504
  </details>
487
505
 
488
- ### SyoboiCalendar::Resources::Title#comment
506
+ ### SyoboiCalendar::Resources::TitleResource#comment
489
507
 
490
508
  ```ruby
491
509
  client.list_titles(title_id: 1).first.comment
@@ -500,7 +518,7 @@ client.list_titles(title_id: 1).first.comment
500
518
 
501
519
  </details>
502
520
 
503
- ### SyoboiCalendar::Resources::Title#english_name
521
+ ### SyoboiCalendar::Resources::TitleResource#english_name
504
522
 
505
523
  ```ruby
506
524
  client.list_titles(title_id: 8).first.english_name
@@ -515,7 +533,7 @@ client.list_titles(title_id: 8).first.english_name
515
533
 
516
534
  </details>
517
535
 
518
- ### SyoboiCalendar::Resources::Title#first_channel
536
+ ### SyoboiCalendar::Resources::TitleResource#first_channel
519
537
 
520
538
  ```ruby
521
539
  client.list_titles(title_id: 1).first.first_channel
@@ -530,7 +548,7 @@ client.list_titles(title_id: 1).first.first_channel
530
548
 
531
549
  </details>
532
550
 
533
- ### SyoboiCalendar::Resources::Title#first_end_month
551
+ ### SyoboiCalendar::Resources::TitleResource#first_end_month
534
552
 
535
553
  ```ruby
536
554
  client.list_titles(title_id: 1).first.first_end_month
@@ -545,7 +563,7 @@ client.list_titles(title_id: 1).first.first_end_month
545
563
 
546
564
  </details>
547
565
 
548
- ### SyoboiCalendar::Resources::Title#first_end_year
566
+ ### SyoboiCalendar::Resources::TitleResource#first_end_year
549
567
 
550
568
  ```ruby
551
569
  client.list_titles(title_id: 1).first.first_end_year
@@ -560,7 +578,7 @@ client.list_titles(title_id: 1).first.first_end_year
560
578
 
561
579
  </details>
562
580
 
563
- ### SyoboiCalendar::Resources::Title#first_month
581
+ ### SyoboiCalendar::Resources::TitleResource#first_month
564
582
 
565
583
  ```ruby
566
584
  client.list_titles(title_id: 1).first.first_month
@@ -575,7 +593,7 @@ client.list_titles(title_id: 1).first.first_month
575
593
 
576
594
  </details>
577
595
 
578
- ### SyoboiCalendar::Resources::Title#first_year
596
+ ### SyoboiCalendar::Resources::TitleResource#first_year
579
597
 
580
598
  ```ruby
581
599
  client.list_titles(title_id: 1).first.first_year
@@ -590,7 +608,7 @@ client.list_titles(title_id: 1).first.first_year
590
608
 
591
609
  </details>
592
610
 
593
- ### SyoboiCalendar::Resources::Title#flag
611
+ ### SyoboiCalendar::Resources::TitleResource#flag
594
612
 
595
613
  ```ruby
596
614
  client.list_titles(title_id: 1).first.flag
@@ -605,7 +623,7 @@ client.list_titles(title_id: 1).first.flag
605
623
 
606
624
  </details>
607
625
 
608
- ### SyoboiCalendar::Resources::Title#id
626
+ ### SyoboiCalendar::Resources::TitleResource#id
609
627
 
610
628
  ```ruby
611
629
  client.list_titles(title_id: 1).first.id
@@ -620,7 +638,7 @@ client.list_titles(title_id: 1).first.id
620
638
 
621
639
  </details>
622
640
 
623
- ### SyoboiCalendar::Resources::Title#kana
641
+ ### SyoboiCalendar::Resources::TitleResource#kana
624
642
 
625
643
  ```ruby
626
644
  client.list_titles(title_id: 1).first.kana
@@ -635,7 +653,7 @@ client.list_titles(title_id: 1).first.kana
635
653
 
636
654
  </details>
637
655
 
638
- ### SyoboiCalendar::Resources::Title#keywords
656
+ ### SyoboiCalendar::Resources::TitleResource#keywords
639
657
 
640
658
  ```ruby
641
659
  client.list_titles(title_id: 2).first.keywords
@@ -650,7 +668,22 @@ client.list_titles(title_id: 2).first.keywords
650
668
 
651
669
  </details>
652
670
 
653
- ### SyoboiCalendar::Resources::Title#point
671
+ ### SyoboiCalendar::Resources::TitleResource#name
672
+
673
+ ```ruby
674
+ client.list_titles(title_id: 1).first.name
675
+ ```
676
+
677
+ <details>
678
+ <summary>Result</summary>
679
+
680
+ ```ruby
681
+ "魔法遣いに大切なこと"
682
+ ```
683
+
684
+ </details>
685
+
686
+ ### SyoboiCalendar::Resources::TitleResource#point
654
687
 
655
688
  ```ruby
656
689
  client.list_titles(title_id: 1).first.point
@@ -665,7 +698,7 @@ client.list_titles(title_id: 1).first.point
665
698
 
666
699
  </details>
667
700
 
668
- ### SyoboiCalendar::Resources::Title#rank
701
+ ### SyoboiCalendar::Resources::TitleResource#rank
669
702
 
670
703
  ```ruby
671
704
  client.list_titles(title_id: 1).first.rank
@@ -680,7 +713,7 @@ client.list_titles(title_id: 1).first.rank
680
713
 
681
714
  </details>
682
715
 
683
- ### SyoboiCalendar::Resources::Title#short_title
716
+ ### SyoboiCalendar::Resources::TitleResource#short_title
684
717
 
685
718
  ```ruby
686
719
  client.list_titles(title_id: 4).first.short_title
@@ -695,7 +728,7 @@ client.list_titles(title_id: 4).first.short_title
695
728
 
696
729
  </details>
697
730
 
698
- ### SyoboiCalendar::Resources::Title#sub_titles
731
+ ### SyoboiCalendar::Resources::TitleResource#sub_titles
699
732
 
700
733
  ```ruby
701
734
  client.list_titles(title_id: 1).first.sub_titles
@@ -49,6 +49,12 @@ module SyoboiCalendar
49
49
 
50
50
  private
51
51
 
52
+ # @param [Array, Integer, String]
53
+ # @return [String]
54
+ def format_comma_separated_values(values)
55
+ ::Array.wrap(values).join(",")
56
+ end
57
+
52
58
  # @param [Time, nil]
53
59
  # @return [String]
54
60
  def format_time(time)
@@ -7,7 +7,9 @@ module SyoboiCalendar
7
7
 
8
8
  # @return [String, nil]
9
9
  def ChID
10
- options[:channel_id]
10
+ if options[:channel_id]
11
+ format_comma_separated_values(options[:channel_id])
12
+ end
11
13
  end
12
14
 
13
15
  # @note Override
@@ -7,14 +7,18 @@ module SyoboiCalendar
7
7
 
8
8
  property :ChID
9
9
  property :Count
10
+ property :Fields
10
11
  property :JOIN
11
12
  property :PID
12
13
  property :Range
13
14
  property :StTime
15
+ property :TID
14
16
 
15
- # @return [Integer, nil]
17
+ # @return [String, nil]
16
18
  def ChID
17
- options[:channel_id]
19
+ if options[:channel_id]
20
+ format_comma_separated_values(options[:channel_id])
21
+ end
18
22
  end
19
23
 
20
24
  # @note Override
@@ -22,9 +26,18 @@ module SyoboiCalendar
22
26
  COMMAND
23
27
  end
24
28
 
25
- # @return [Integer, nil]
29
+ # @return [String, nil]
26
30
  def Count
27
- options[:count]
31
+ if options[:count]
32
+ format_comma_separated_values(options[:count])
33
+ end
34
+ end
35
+
36
+ # @return [String, nil]
37
+ def Fields
38
+ if options[:fields]
39
+ format_comma_separated_values(options[:fields])
40
+ end
28
41
  end
29
42
 
30
43
  # @return [String]
@@ -32,9 +45,11 @@ module SyoboiCalendar
32
45
  JOIN
33
46
  end
34
47
 
35
- # @return [Integer, nil]
48
+ # @return [String, nil]
36
49
  def PID
37
- options[:program_id]
50
+ if options[:program_id]
51
+ format_comma_separated_values(options[:program_id])
52
+ end
38
53
  end
39
54
 
40
55
  # @return [String, nil]
@@ -46,6 +61,13 @@ module SyoboiCalendar
46
61
  def StTime
47
62
  format_time_range(options[:started_from], options[:started_to])
48
63
  end
64
+
65
+ # @return [String, nil]
66
+ def TID
67
+ if options[:title_id]
68
+ format_comma_separated_values(options[:title_id])
69
+ end
70
+ end
49
71
  end
50
72
  end
51
73
  end
@@ -3,6 +3,7 @@ module SyoboiCalendar
3
3
  class TitleQuery < BaseQuery
4
4
  COMMAND = "TitleLookup"
5
5
 
6
+ property :Fields
6
7
  property :TID
7
8
 
8
9
  # @note Override
@@ -10,9 +11,20 @@ module SyoboiCalendar
10
11
  COMMAND
11
12
  end
12
13
 
13
- # @return [Integer, String]
14
+ # @return [String, nil]
15
+ def Fields
16
+ if options[:fields]
17
+ format_comma_separated_values(options[:fields])
18
+ end
19
+ end
20
+
21
+ # @return [String]
14
22
  def TID
15
- options[:title_id] || "*"
23
+ if options[:title_id]
24
+ format_comma_separated_values(options[:title_id])
25
+ else
26
+ "*"
27
+ end
16
28
  end
17
29
  end
18
30
  end
@@ -1,3 +1,3 @@
1
1
  module SyoboiCalendar
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syoboi_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-29 00:00:00.000000000 Z
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport