Module: Syobocalite

Defined in:
lib/syobocalite.rb,
lib/syobocalite/program.rb,
lib/syobocalite/version.rb,
lib/syobocalite/db_client.rb

Defined Under Namespace

Classes: DbClient, Program

Constant Summary collapse

VERSION =
"1.1.1"

Class Method Summary collapse

Class Method Details

.search(start_at:, end_at:) ⇒ Array<Program>

Search programs between start_at and end_at

Parameters:

  • start_at (Time)
  • end_at (Time)

Returns:

See Also:



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/syobocalite.rb', line 17

def self.search(start_at:, end_at:)
  xml = fetch(start_at: start_at, end_at: end_at)
  response = MultiXml.parse(xml)
  prog_items = response["syobocal"]["ProgItems"]["ProgItem"]

  programs = prog_items.map { |prog_item| Syobocalite::Program.from_prog_item(prog_item) }

  programs.select do |program|
    (start_at...end_at).cover?(program.st_time)
  end
end

.user_agentString

Returns:

  • (String)


30
31
32
# File 'lib/syobocalite.rb', line 30

def self.user_agent
  "Syobocalite v#{Syobocalite::VERSION} (+https://github.com/sue445/syobocalite)"
end