Class: SerenityNow::SerenityAPI

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/serenity_now/serenity_api.rb

Instance Method Summary collapse

Instance Method Details

#e_info(show_id, episode = '') ⇒ Object

Episode Info



62
63
64
65
# File 'lib/serenity_now/serenity_api.rb', line 62

def e_info( show_id, episode='' )
  query = { sid: show_id, ep: episode }
  self.class.get( '/episodeinfo.php', query: query )
end

#info(show_id, episodes = false) ⇒ Object

Show Info and Show Info + Episode List



47
48
49
50
# File 'lib/serenity_now/serenity_api.rb', line 47

def info( show_id, episodes = false )
  endpoint = episodes ? '/full_show_info.php' : '/showinfo.php'
  self.class.get( endpoint, query: { sid: show_id } )
end

#list(show_id) ⇒ Object

Episode List



55
56
57
# File 'lib/serenity_now/serenity_api.rb', line 55

def list( show_id )
  self.class.get( '/episode_list.php', query: { sid: show_id } )
end

#schedule(country = 'US', format24 = false) ⇒ Object

Full Schedule available options: { country: ‘US’, 24_format: ‘1’ }



71
72
73
74
# File 'lib/serenity_now/serenity_api.rb', line 71

def schedule( country = 'US', format24 = false )
  uri = "/fullschedule.php?country="+country+"&24_format=" + (format24 ? '1' : '0')
  self.class.get( uri )
end

#search(show_name, detailed = false) ⇒ Object

Search and Detailed Search



39
40
41
42
# File 'lib/serenity_now/serenity_api.rb', line 39

def search( show_name, detailed = false )
  endpoint = detailed ? '/full_search.php' : '/search.php'
  self.class.get( endpoint, query: { show: show_name } )
end