Class KizAPI::RelatedWords
In: lib/kizapi.rb
Parent: Array

RelatedWords is a class for searching related words of a keyword.

Methods

day   month   new   week  

Attributes

date  [R]  measured time
keyword  [R] 
span  [R] 

Public Class methods

Same as RelatedWords.new(keyword, "24").

[Source]

    # File lib/kizapi.rb, line 52
52:     def self.day(keyword)
53:       new(keyword, "24")
54:     end

Same as RelatedWords.new(keyword, "1m").

[Source]

    # File lib/kizapi.rb, line 62
62:     def self.month(keyword)
63:       new(keyword, "1m")
64:     end

Make a list of related words of a keyword.

keyword:keyword in UTF-8
span:"24", "1w", or "1m"

[Source]

    # File lib/kizapi.rb, line 39
39:     def initialize(keyword, span="24")
40:       @keyword = keyword
41:       @span = span
42:       uri = URI.parse(URI.escape("http://kizasi.jp/kizapi.py?span=\#{span}&kw_expr=\#{keyword}&type=coll\n".chomp))
43:       rss = RSS::Parser.parse(uri.read)
44:       @date = rss.channel.lastBuildDate
45:       super(rss.items.map{|item| item.title})
46:     end

Same as RelatedWords.new(keyword, "1w").

[Source]

    # File lib/kizapi.rb, line 57
57:     def self.week(keyword)
58:       new(keyword, "1w")
59:     end

[Validate]