tmsapi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +86 -0
- data/.project +17 -0
- data/.rspec +2 -0
- data/.travis.yml +11 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +94 -0
- data/Rakefile +14 -0
- data/Readme.md +62 -0
- data/lib/tmsapi/api.rb +61 -0
- data/lib/tmsapi/middleware/custom_logger.rb +70 -0
- data/lib/tmsapi/model/airing.rb +24 -0
- data/lib/tmsapi/model/award.rb +14 -0
- data/lib/tmsapi/model/base.rb +9 -0
- data/lib/tmsapi/model/caption.rb +8 -0
- data/lib/tmsapi/model/episode.rb +11 -0
- data/lib/tmsapi/model/event.rb +10 -0
- data/lib/tmsapi/model/image.rb +16 -0
- data/lib/tmsapi/model/lineup.rb +12 -0
- data/lib/tmsapi/model/movie.rb +16 -0
- data/lib/tmsapi/model/person.rb +12 -0
- data/lib/tmsapi/model/program.rb +36 -0
- data/lib/tmsapi/model/quality_rating.rb +8 -0
- data/lib/tmsapi/model/rating.rb +8 -0
- data/lib/tmsapi/model/recommendation.rb +9 -0
- data/lib/tmsapi/model/showtime.rb +13 -0
- data/lib/tmsapi/model/sport_event.rb +11 -0
- data/lib/tmsapi/model/station.rb +19 -0
- data/lib/tmsapi/model/station_airings.rb +14 -0
- data/lib/tmsapi/model/team.rb +9 -0
- data/lib/tmsapi/model/theatre.rb +8 -0
- data/lib/tmsapi/model.rb +26 -0
- data/lib/tmsapi/resource/base.rb +20 -0
- data/lib/tmsapi/resource/lineups.rb +58 -0
- data/lib/tmsapi/resource/movies.rb +21 -0
- data/lib/tmsapi/resource/movies_theatres.rb +37 -0
- data/lib/tmsapi/resource/movies_tv.rb +41 -0
- data/lib/tmsapi/resource/programs.rb +103 -0
- data/lib/tmsapi/resource/series.rb +45 -0
- data/lib/tmsapi/resource/sports.rb +35 -0
- data/lib/tmsapi/resource/stations.rb +47 -0
- data/lib/tmsapi/resource.rb +13 -0
- data/lib/tmsapi/version.rb +3 -0
- data/lib/tmsapi.rb +10 -0
- data/spec/api_spec.rb +354 -0
- data/spec/factories.rb +56 -0
- data/spec/model/program_spec.rb +33 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/support/vcr.rb +20 -0
- data/spec/tms_api_spec.rb +7 -0
- data/spec/vcr/cassettes/TMSAPI_API/_lineups/_airings/should_tell_me_whats_airing.yml +37649 -0
- data/spec/vcr/cassettes/TMSAPI_API/_lineups/_channels/should_list_some_channels.yml +2623 -0
- data/spec/vcr/cassettes/TMSAPI_API/_lineups/_details/should_tell_me_about_the_lineup.yml +67 -0
- data/spec/vcr/cassettes/TMSAPI_API/_lineups/_find/should_find_local_lineups.yml +103 -0
- data/spec/vcr/cassettes/TMSAPI_API/_lineups/_stations/should_list_some_channels.yml +2623 -0
- data/spec/vcr/cassettes/TMSAPI_API/_movies/_theatres/_showings/should_get_movie_showings.yml +460 -0
- data/spec/vcr/cassettes/TMSAPI_API/_movies/_tv/_airings/should_tell_me_what_movies_are_on_tv.yml +6722 -0
- data/spec/vcr/cassettes/TMSAPI_API/_movies/_tv/_versions/should_tell_me_about_that_movie.yml +1366 -0
- data/spec/vcr/cassettes/TMSAPI_API/_programs/_advance_planner/should_list_holiday_events.yml +1951 -0
- data/spec/vcr/cassettes/TMSAPI_API/_programs/_airings/should_find_airings.yml +85 -0
- data/spec/vcr/cassettes/TMSAPI_API/_programs/_details/should_be_filled_with_program_information.yml +117 -0
- data/spec/vcr/cassettes/TMSAPI_API/_programs/_genres/should_return_all_genres.yml +131 -0
- data/spec/vcr/cassettes/TMSAPI_API/_programs/_images/should_return_images.yml +225 -0
- data/spec/vcr/cassettes/TMSAPI_API/_programs/_new_past_week/should_have_programs.yml +2238 -0
- data/spec/vcr/cassettes/TMSAPI_API/_programs/_new_shows/should_find_new_shows.yml +1105 -0
- data/spec/vcr/cassettes/TMSAPI_API/_programs/_search/should_find_4_programs.yml +152 -0
- data/spec/vcr/cassettes/TMSAPI_API/_series/_airings/should_list_airings.yml +341 -0
- data/spec/vcr/cassettes/TMSAPI_API/_series/_details/should_find_the_series.yml +272 -0
- data/spec/vcr/cassettes/TMSAPI_API/_series/_episodes/should_return_episodes.yml +3492 -0
- data/spec/vcr/cassettes/TMSAPI_API/_stations/_airings/should_list_airings.yml +123 -0
- data/spec/vcr/cassettes/TMSAPI_API/_stations/_details/should_get_station_details.yml +67 -0
- data/tmsapi.gemspec +42 -0
- metadata +296 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'tmsapi/model/image'
|
2
|
+
|
3
|
+
module TMSAPI
|
4
|
+
module Model
|
5
|
+
class Station < Base
|
6
|
+
attribute :stationId, Integer
|
7
|
+
attribute :name, String
|
8
|
+
attribute :call_sign, String
|
9
|
+
attribute :type, String
|
10
|
+
attribute :bcastLangs, Array[String]
|
11
|
+
attribute :edLags, Array[String]
|
12
|
+
attribute :channel, Integer
|
13
|
+
attribute :affiliate_call_sign, String
|
14
|
+
attribute :affiliate_id, Integer
|
15
|
+
attribute :preferred_image, TMSAPI::Model::Image
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'tmsapi/model/image'
|
2
|
+
require 'tmsapi/model/airing'
|
3
|
+
|
4
|
+
module TMSAPI
|
5
|
+
module Model
|
6
|
+
class Station_Airings < Base
|
7
|
+
attribute :channel, Integer
|
8
|
+
attribute :call_sign, String
|
9
|
+
attribute :station_id, Integer
|
10
|
+
attribute :preferred_image, TMSAPI::Model::Image
|
11
|
+
attribute :airings, Array[TMSAPI::Model::Airing]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/tmsapi/model.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'tmsapi/model/base'
|
2
|
+
require 'tmsapi/model/caption'
|
3
|
+
require 'tmsapi/model/airing'
|
4
|
+
require 'tmsapi/model/award'
|
5
|
+
require 'tmsapi/model/image'
|
6
|
+
require 'tmsapi/model/person'
|
7
|
+
require 'tmsapi/model/program'
|
8
|
+
require 'tmsapi/model/rating'
|
9
|
+
require 'tmsapi/model/recommendation'
|
10
|
+
require 'tmsapi/model/station'
|
11
|
+
require 'tmsapi/model/event'
|
12
|
+
require 'tmsapi/model/lineup'
|
13
|
+
require 'tmsapi/model/station_airings'
|
14
|
+
require 'tmsapi/model/episode'
|
15
|
+
require 'tmsapi/model/quality_rating'
|
16
|
+
require 'tmsapi/model/theatre'
|
17
|
+
require 'tmsapi/model/showtime'
|
18
|
+
require 'tmsapi/model/movie'
|
19
|
+
require 'tmsapi/model/sport_event'
|
20
|
+
require 'tmsapi/model/team'
|
21
|
+
|
22
|
+
module TMSAPI
|
23
|
+
module Model
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module TMSAPI
|
2
|
+
module Resource
|
3
|
+
class Base
|
4
|
+
def initialize(connection, version, options = {})
|
5
|
+
@connection = connection
|
6
|
+
@version = version
|
7
|
+
end
|
8
|
+
|
9
|
+
def get(path, options={})
|
10
|
+
@connection.get(full_path(path), options).body
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def full_path(path)
|
16
|
+
"#{@version}/#{path}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'tmsapi/model/lineup'
|
2
|
+
|
3
|
+
module TMSAPI
|
4
|
+
module Resource
|
5
|
+
class Lineups < Base
|
6
|
+
|
7
|
+
def initialize(connection, options = {})
|
8
|
+
super(connection, "v1")
|
9
|
+
end
|
10
|
+
|
11
|
+
def find(params)
|
12
|
+
get(base_path,params).each do |lineup|
|
13
|
+
TMSAPI::Model::Lineup.new lineup
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def details(lineup_id)
|
18
|
+
TMSAPI::Model::Lineup.new get(details_path(lineup_id))
|
19
|
+
end
|
20
|
+
|
21
|
+
def channels(lineup_id, params = nil)
|
22
|
+
get(channels_path(lineup_id),params).each do |station|
|
23
|
+
TMSAPI::Model::Station.new station
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def stations(lineup_id, params = nil)
|
28
|
+
channels(lineup_id,params)
|
29
|
+
end
|
30
|
+
|
31
|
+
def airings(lineup_id, params = nil)
|
32
|
+
params = { :startDateTime => Time.now.strftime("%Y-%m-%dT%H:%MZ") } unless params
|
33
|
+
get(airings_path(lineup_id),params).each do |station|
|
34
|
+
TMSAPI::Model::Station_Airings.new station
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def details_path(lineup_id)
|
41
|
+
"#{base_path}/#{lineup_id}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def channels_path(lineup_id)
|
45
|
+
"#{details_path(lineup_id)}/channels"
|
46
|
+
end
|
47
|
+
|
48
|
+
def airings_path(lineup_id)
|
49
|
+
"#{details_path(lineup_id)}/grid"
|
50
|
+
end
|
51
|
+
|
52
|
+
def base_path
|
53
|
+
"lineups"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'tmsapi/resource/movies_tv'
|
2
|
+
require 'tmsapi/resource/movies_theatres'
|
3
|
+
|
4
|
+
module TMSAPI
|
5
|
+
module Resource
|
6
|
+
class Movies
|
7
|
+
def initialize(connection)
|
8
|
+
@connection = connection
|
9
|
+
end
|
10
|
+
|
11
|
+
def tv
|
12
|
+
TMSAPI::Resource::Movie::TV.new @connection
|
13
|
+
end
|
14
|
+
|
15
|
+
def theatres
|
16
|
+
TMSAPI::Resource::Movie::Theatres.new @connection
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'tmsapi/resource/base'
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
module TMSAPI
|
5
|
+
module Resource
|
6
|
+
module Movie
|
7
|
+
class Theatres < TMSAPI::Resource::Base
|
8
|
+
|
9
|
+
def initialize(connection, options = {})
|
10
|
+
super(connection, "v1")
|
11
|
+
end
|
12
|
+
|
13
|
+
def showings(params)
|
14
|
+
params[:startDate] = Date.today unless params[:startDate]
|
15
|
+
get(showings_path, params).each do |movie|
|
16
|
+
TMSAPI::Model::Movie.new movie
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def showings_path
|
23
|
+
"#{alt_path}/showings"
|
24
|
+
end
|
25
|
+
|
26
|
+
def base_path
|
27
|
+
"theatres"
|
28
|
+
end
|
29
|
+
|
30
|
+
def alt_path
|
31
|
+
"movies"
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module TMSAPI
|
2
|
+
module Resource
|
3
|
+
module Movie
|
4
|
+
class TV < TMSAPI::Resource::Base
|
5
|
+
|
6
|
+
def initialize(connection, options = {})
|
7
|
+
super(connection, "v1")
|
8
|
+
end
|
9
|
+
|
10
|
+
def versions(root_id, params = nil)
|
11
|
+
get(versions_path(root_id),params).each do |movie|
|
12
|
+
TMSAPI::Model::Movie.new movie
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def airings(params)
|
17
|
+
params[:startDateTime] = Time.now.strftime("%Y-%m-%dT%H:%MZ") unless params[:startDateTime]
|
18
|
+
|
19
|
+
get(airings_path, params).each do |airing|
|
20
|
+
TMSAPI::Model::Airing.new airing
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def airings_path
|
27
|
+
"#{base_path}/airings"
|
28
|
+
end
|
29
|
+
|
30
|
+
def versions_path(root_id)
|
31
|
+
"#{base_path}/#{root_id}/versions"
|
32
|
+
end
|
33
|
+
|
34
|
+
def base_path
|
35
|
+
"movies"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'tmsapi/model/program'
|
2
|
+
require 'tmsapi/model/airing'
|
3
|
+
require 'tmsapi/model/event'
|
4
|
+
require 'date'
|
5
|
+
|
6
|
+
module TMSAPI
|
7
|
+
module Resource
|
8
|
+
class Programs < Base
|
9
|
+
|
10
|
+
def initialize(connection, options = {})
|
11
|
+
super(connection, "v1")
|
12
|
+
end
|
13
|
+
|
14
|
+
def search(params)
|
15
|
+
get(search_path, params).hits.map do |root|
|
16
|
+
TMSAPI::Model::Program.new root.program
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def details(tms_id, params = nil)
|
21
|
+
TMSAPI::Model::Program.new get(details_path(tms_id), params)
|
22
|
+
end
|
23
|
+
|
24
|
+
def airings(tms_id, params = nil)
|
25
|
+
get(airings_path(tms_id), params).map do |airing|
|
26
|
+
TMSAPI::Model::Airing.new airing
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def new_shows(params)
|
31
|
+
params[:startDateTime] = Time.now.strftime("%Y-%m-%dT%H:%MZ") unless params[:startDateTime]
|
32
|
+
|
33
|
+
get(new_shows_path,params).each do |new_program|
|
34
|
+
TMSAPI::Model::Airing.new new_program
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def new_past_week(params = nil)
|
39
|
+
params = {:startDate => (Date.today - 7).to_s} unless params
|
40
|
+
get(new_past_week_path,params).each do |new_program|
|
41
|
+
TMSAPI::Model::Program.new new_program
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def advance_planner(params = nil)
|
46
|
+
params = {:startDate => (Date.today + 1).to_s} unless params
|
47
|
+
|
48
|
+
get(advance_planner_path,params).each do |event|
|
49
|
+
TMSAPI::Model::Event.new event
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def images(resource_id, params = nil)
|
54
|
+
get(images_path(resource_id), params).each do |image|
|
55
|
+
TMSAPI::Model::Image.new image
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def genres
|
60
|
+
get(genres_path)
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def search_path
|
66
|
+
"#{base_path}/search"
|
67
|
+
end
|
68
|
+
|
69
|
+
def details_path(tms_id)
|
70
|
+
"#{base_path}/#{tms_id}"
|
71
|
+
end
|
72
|
+
|
73
|
+
def airings_path(tms_id)
|
74
|
+
"#{details_path(tms_id)}/airings"
|
75
|
+
end
|
76
|
+
|
77
|
+
def new_shows_path
|
78
|
+
"#{base_path}/newShowAirings"
|
79
|
+
end
|
80
|
+
|
81
|
+
def new_past_week_path
|
82
|
+
"#{base_path}/newShowsLastWeek"
|
83
|
+
end
|
84
|
+
|
85
|
+
def advance_planner_path
|
86
|
+
"#{base_path}/advancePlanner"
|
87
|
+
end
|
88
|
+
|
89
|
+
def images_path(resource_id)
|
90
|
+
"#{base_path}/#{resource_id}/images"
|
91
|
+
end
|
92
|
+
|
93
|
+
def genres_path
|
94
|
+
"#{base_path}/genres"
|
95
|
+
end
|
96
|
+
|
97
|
+
def base_path
|
98
|
+
"programs"
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module TMSAPI
|
2
|
+
module Resource
|
3
|
+
class Series < Base
|
4
|
+
|
5
|
+
def initialize(connection, options = {})
|
6
|
+
super(connection, "v1")
|
7
|
+
end
|
8
|
+
|
9
|
+
def details(series_id, params = nil)
|
10
|
+
TMSAPI::Model::Program.new get(details_path(series_id), params)
|
11
|
+
end
|
12
|
+
|
13
|
+
def airings(series_id, params)
|
14
|
+
get(airings_path(series_id),params).each do |airing|
|
15
|
+
TMSAPI::Model::Airing.new airing
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def episodes(series_id, params = nil)
|
20
|
+
get(episodes_path(series_id), params).each do |episode|
|
21
|
+
TMSAPI::Model::Episode.new episode
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def details_path(series_id)
|
28
|
+
"#{base_path}/#{series_id}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def airings_path(series_id)
|
32
|
+
"#{details_path(series_id)}/airings"
|
33
|
+
end
|
34
|
+
|
35
|
+
def episodes_path(series_id)
|
36
|
+
"#{details_path(series_id)}/episodes"
|
37
|
+
end
|
38
|
+
|
39
|
+
def base_path
|
40
|
+
"series"
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'tmsapi/model/program'
|
2
|
+
|
3
|
+
module TMSAPI
|
4
|
+
module Resource
|
5
|
+
class Sports < Base
|
6
|
+
|
7
|
+
def initialize(connection, options = {})
|
8
|
+
super(connection, "v1")
|
9
|
+
end
|
10
|
+
|
11
|
+
def event_airings(sports_id, params)
|
12
|
+
params[:startDateTime] = Time.now.strftime("%Y-%m-%dT%H:%MZ") unless params[:startDateTime]
|
13
|
+
|
14
|
+
get(event_airings_path(sports_id),params).each do |event|
|
15
|
+
TMSAPI::Model::SportEvent.new event
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def details_path(sports_id)
|
22
|
+
"#{base_path}/#{sports_id}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def event_airings_path(sports_id)
|
26
|
+
"#{details_path(sports_id)}/events"
|
27
|
+
end
|
28
|
+
|
29
|
+
def base_path
|
30
|
+
"sports"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'tmsapi/model/station'
|
2
|
+
|
3
|
+
module TMSAPI
|
4
|
+
module Resource
|
5
|
+
class Stations < Base
|
6
|
+
|
7
|
+
def initialize(connection, options = {})
|
8
|
+
super(connection, "v1")
|
9
|
+
end
|
10
|
+
|
11
|
+
def details(stationId, lineupId = nil)
|
12
|
+
if lineupId then
|
13
|
+
params = {:lineupId => lineupId}
|
14
|
+
else
|
15
|
+
params = nil
|
16
|
+
end
|
17
|
+
|
18
|
+
get(details_path(stationId),params).each do |station|
|
19
|
+
TMSAPI::Model::Station.new station
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def airings(stationId, params)
|
24
|
+
params = { :startDateTime => Time.now.strftime("%Y-%m-%dT%H:%MZ")} unless params
|
25
|
+
|
26
|
+
get(airings_path(stationId),params).each do |airing|
|
27
|
+
TMSAPI::Model::Airing.new airing
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def details_path(stationId)
|
34
|
+
"#{base_path}/#{stationId}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def airings_path(stationId)
|
38
|
+
"#{details_path(stationId)}/airings"
|
39
|
+
end
|
40
|
+
|
41
|
+
def base_path
|
42
|
+
"stations"
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'tmsapi/resource/base'
|
2
|
+
require 'tmsapi/resource/programs'
|
3
|
+
require 'tmsapi/resource/stations'
|
4
|
+
require 'tmsapi/resource/lineups'
|
5
|
+
require 'tmsapi/resource/series'
|
6
|
+
require 'tmsapi/resource/movies'
|
7
|
+
require 'tmsapi/resource/sports'
|
8
|
+
|
9
|
+
module TMSAPI
|
10
|
+
module Resource
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|