fanfeedr 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in fanfeedr_new.gemspec
4
+ gemspec
@@ -0,0 +1,42 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fanfeedr (0.2.0)
5
+ hashie
6
+ httparty
7
+ json
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ addressable (2.2.6)
13
+ crack (0.3.1)
14
+ diff-lcs (1.1.3)
15
+ hashie (1.2.0)
16
+ httparty (0.8.1)
17
+ multi_json
18
+ multi_xml
19
+ json (1.6.5)
20
+ multi_json (1.0.4)
21
+ multi_xml (0.4.1)
22
+ rspec (2.8.0)
23
+ rspec-core (~> 2.8.0)
24
+ rspec-expectations (~> 2.8.0)
25
+ rspec-mocks (~> 2.8.0)
26
+ rspec-core (2.8.0)
27
+ rspec-expectations (2.8.0)
28
+ diff-lcs (~> 1.1.2)
29
+ rspec-mocks (2.8.0)
30
+ vcr (1.11.3)
31
+ webmock (1.7.10)
32
+ addressable (~> 2.2, > 2.2.5)
33
+ crack (>= 0.1.7)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ fanfeedr!
40
+ rspec
41
+ vcr
42
+ webmock
data/README.md CHANGED
@@ -4,38 +4,38 @@ This is a Ruby wrapper for the [Fanfeedr API](http://developer.fanfeedr.com/).
4
4
 
5
5
  ## Installation
6
6
 
7
- In your Rails directory:
7
+ As a gem:
8
8
 
9
- script/plugin install git://github.com/phuphighter/fanfeedr.git
9
+ sudo gem install fanfeedr
10
+
11
+ In a gemfile:
12
+
13
+ gem 'fanfeedr'
10
14
 
11
15
  ## Get a Fanfeedr API key
12
16
 
13
- Sign up for a Fanfeedr API key: [http://developer.fanfeedr.com/member/register](http://developer.fanfeedr.com/member/register)
17
+ Sign up for a Fanfeedr API key: [http://developer.fanfeedr.com/page/API_Plans_and_Pricing](http://developer.fanfeedr.com/page/API_Plans_and_Pricing)
14
18
 
15
19
  ## Usage
16
20
 
17
21
  ### Instantiate a client
18
22
 
19
- >> fanfeedr = Fanfeedr::Client.new(:api_key => 'your_api_key', :api_type => 'your_api_type')
20
-
21
- ### or configure once
22
-
23
- >> Fanfeedr.configure do |config|
24
- >> config.api_key = 'your_api_key'
25
- >> config.api_type = 'your_api_type'
26
- >> end
27
- >> fanfeedr = Fanfeedr::Client.new
23
+ >> @client = Fanfeedr::Client.new(:api_key => 'your_api_key', :tier => 'your_tier')
28
24
 
29
25
  #### Examples
30
-
31
- >> fanfeedr.scores(:resource => "team://mlb/texas_rangers", :rows => '2')
32
- => [{"defaultdict(<type 'str'>, {'eventlink': u'event://mlb/2010/05/15/games/texas_rangers_toronto_blue_jays', 'winteamlocationshort': u'Toronto', 'loseteamlogo': u'/img/teams/small/texas_rangers_25.png', 'is_college': u'False', 'loseteamlocation': u'Texas', 'winteamname': u'Blue Jays', 'loseteamfullname': u'Rangers', 'sport': u'Baseball', 'winscore': u'6', 'league': u'league://mlb', 'losescore': u'0', 'loseteamlink': u'team://mlb/texas_rangers', 'loseteamlocationshort': u'Texas', 'season_type': u'None', 'winteamfullname': u'Blue Jays', 'winteamlink': u'team://mlb/toronto_blue_jays', 'season_year': u'None', 'winteamlogo': u'/img/teams/small/toronto_blue_jays_25.png', 'winteamhomeaway': u'A', 'winteamlocation': u'Toronto', 'loseteamname': u'Rangers'})"=>[nil]}]
33
26
 
34
- >> fanfeedr.schedule(:resource => "team://nba/boston_celtics")
35
- => [{"name"=>"Boston Celtics @ Orlando Magic", "time"=>"20:30:00", "date"=>Sun, 30 May 2010, "away"=>{"winlose"=>nil, "team"=>"team://nba/boston_celtics", "score"=>nil}, "status"=>nil, "home"=>{"winlose"=>nil, "team"=>"team://nba/orlando_magic", "score"=>nil}, "resource_text"=>"event://nba/2010/05/30/games/boston_celtics_orlando_magic"}]
27
+ >> @leagues = @client.leagues(:id => "20f0857f-3c43-5f50-acfc-879f838ee853")
28
+ >> @leagues.size
29
+ => 45
30
+
31
+ >> @client.leagues(:id => "20f0857f-3c43-5f50-acfc-879f838ee853")
32
+ => {"sport"=>"Baseball", "name"=>"MLB", "gender"=>"M", "id"=>"20f0857f-3c43-5f50-acfc-879f838ee853", "levels"=>["professional"]}
36
33
 
34
+ >> @client.conferences(:id => "384fbe7c-7694-51e8-bf0a-7d0d63ba9211", :parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853")
35
+ => {"id"=>"384fbe7c-7694-51e8-bf0a-7d0d63ba9211", "level"=>"professional", "name"=>"National League"}
36
+
37
37
  ## Copyright
38
38
 
39
39
  Contact me if you have any suggestions and feel free to fork it!
40
40
 
41
- Copyright (c) 2009 Johnny Khai Nguyen, released under the MIT license
41
+ Copyright (c) 2012 Johnny Khai Nguyen, released under the MIT license
data/Rakefile CHANGED
@@ -1,41 +1,6 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/testtask'
4
- require 'rake/rdoctask'
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
5
3
 
6
- begin
7
- require 'jeweler'
8
- Jeweler::Tasks.new do |gem|
9
- gem.name = "fanfeedr"
10
- gem.summary = %Q{Ruby wrapper for the Fanfeedr API}
11
- gem.description = %Q{Ruby wrapper for the Fanfeedr API}
12
- gem.email = "johnnyn@gmail.com"
13
- gem.homepage = "http://github.com/phuphighter/fanfeedr"
14
- gem.authors = ["Johnny Khai Nguyen"]
15
-
16
- gem.add_dependency('httparty', '>= 0.5.0')
17
- end
18
- Jeweler::GemcutterTasks.new
19
- rescue LoadError
20
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
21
- end
4
+ RSpec::Core::RakeTask.new('spec')
22
5
 
23
- desc 'Default: run unit tests.'
24
- task :default => :test
25
-
26
- desc 'Test the fanfeedr plugin.'
27
- Rake::TestTask.new(:test) do |t|
28
- t.libs << 'lib'
29
- t.libs << 'test'
30
- t.pattern = 'test/**/*_test.rb'
31
- t.verbose = true
32
- end
33
-
34
- desc 'Generate documentation for the fanfeedr plugin.'
35
- Rake::RDocTask.new(:rdoc) do |rdoc|
36
- rdoc.rdoc_dir = 'rdoc'
37
- rdoc.title = 'Fanfeedr'
38
- rdoc.options << '--line-numbers' << '--inline-source'
39
- rdoc.rdoc_files.include('README')
40
- rdoc.rdoc_files.include('lib/**/*.rb')
41
- end
6
+ task :default => :spec
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "fanfeedr/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "fanfeedr"
7
+ s.version = Fanfeedr::VERSION
8
+ s.authors = ["Johnny Khai Nguyen"]
9
+ s.email = ["johnnyn@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Ruby wrapper for the Fanfeedr API}
12
+ s.description = %q{Use this to access the Fanfeedr API in your Ruby application}
13
+
14
+ s.rubyforge_project = "fanfeedr_new"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'httparty'
22
+ s.add_dependency 'hashie'
23
+ s.add_dependency 'json'
24
+ s.add_development_dependency 'rspec'
25
+ s.add_development_dependency 'webmock'
26
+ s.add_development_dependency 'vcr'
27
+ end
@@ -31,7 +31,7 @@ module Fanfeedr
31
31
 
32
32
  class << self
33
33
  attr_accessor :api_key
34
- attr_accessor :api_type
34
+ attr_accessor :tier
35
35
  end
36
36
 
37
37
  end
@@ -2,80 +2,149 @@ module Fanfeedr
2
2
 
3
3
  class Client
4
4
  include HTTParty
5
- base_uri "http://api.fanfeedr.com"
5
+ base_uri "http://ffapi.fanfeedr.com"
6
6
 
7
7
  attr_reader :api_key
8
- attr_reader :api_type
8
+ attr_reader :tier
9
9
 
10
10
  def initialize(options={})
11
11
  @api_key = options[:api_key] || Fanfeedr.api_key
12
- @api_type = options[:api_type] || Fanfeedr.api_type
12
+ @tier = options[:tier] || Fanfeedr.tier
13
13
  end
14
14
 
15
- def geo_feed(options={})
16
- response = self.class.get("/#{@api_type}/geo_feed", :query => options.merge(self.default_xml_options), :format => :xml)["response"]["result"]["doc"]
15
+ def leagues(options={})
16
+ id = options.delete(:id)
17
+
18
+ if id
19
+ response = self.class.get("/#{@tier}/api/leagues/#{id}", :query => options.merge(self.default_options), :format => :json)
20
+ else
21
+ response = self.class.get("/#{@tier}/api/leagues", :query => options.merge(self.default_options), :format => :json)
22
+ end
17
23
  end
18
-
19
- def schedule(options={})
20
- response = self.class.get("/#{@api_type}/schedule", :query => options.merge(self.default_json_options), :format => :json)
24
+
25
+ def conferences(options={})
26
+ id = options.delete(:id)
27
+ parent_resource = options.delete(:parent_resource)
28
+ resource_id = options.delete(:resource_id)
29
+
30
+ if id
31
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/conferences/#{id}", :query => options.merge(self.default_options), :format => :json)
32
+ else
33
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/conferences", :query => options.merge(self.default_options), :format => :json)
34
+ end
21
35
  end
22
36
 
23
- def suggest(options={})
24
- response = self.class.get("/#{@api_type}/suggest", :query => options.merge(self.default_json_options), :format => :json)
37
+ def divisions(options={})
38
+ id = options.delete(:id)
39
+ parent_resource = options.delete(:parent_resource)
40
+ resource_id = options.delete(:resource_id)
41
+
42
+ if id
43
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/divisions/#{id}", :query => options.merge(self.default_options), :format => :json)
44
+ else
45
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/divisions", :query => options.merge(self.default_options), :format => :json)
46
+ end
25
47
  end
26
48
 
27
- def search(options={})
28
- response = self.class.get("/#{@api_type}/search", :query => options.merge(self.default_json_options), :format => :json)
49
+ def teams(options={}, secondary=nil)
50
+ id = options.delete(:id)
51
+ parent_resource = options.delete(:parent_resource)
52
+ resource_id = options.delete(:resource_id)
53
+
54
+ if id && secondary.nil?
55
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/teams/#{id}", :query => options.merge(self.default_options), :format => :json)
56
+ elsif id && !secondary.nil?
57
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/teams/#{id}/#{secondary}", :query => options.merge(self.default_options), :format => :json)
58
+ else
59
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/teams", :query => options.merge(self.default_options), :format => :json)
60
+ end
29
61
  end
30
62
 
31
- def all_scores(options={})
32
- response = []
33
- results = self.class.get("/#{@api_type}/all_scores", :query => options.merge(self.default_xml_options), :format => :xml)["response"]["result"]["doc"]
63
+ def persons(options={})
64
+ id = options.delete(:id)
65
+ parent_resource = options.delete(:parent_resource)
66
+ resource_id = options.delete(:resource_id)
34
67
 
35
- results.each do |r|
36
- score_details = CGI::parse(r['str'][0])
37
- response << score_details
68
+ if id
69
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/persons/#{id}", :query => options.merge(self.default_options), :format => :json)
70
+ else
71
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/persons", :query => options.merge(self.default_options), :format => :json)
38
72
  end
39
-
40
- response
41
73
  end
42
-
43
- def scores(options={})
44
- response = []
45
- results = self.class.get("/#{@api_type}/scores", :query => options.merge(self.default_xml_options), :format => :xml)["response"]["result"]["doc"]
74
+
75
+ def geo(options={}, secondary=nil)
76
+ id = options.delete(:id)
46
77
 
47
- results.each do |r|
48
- score_details = CGI::parse(r['str'][0])
49
- response << score_details
78
+ if id && secondary.nil?
79
+ response = self.class.get("/#{@tier}/api/geo/#{id}", :query => options.merge(self.default_options), :format => :json)
80
+ elsif id && !secondary.nil?
81
+ response = self.class.get("/#{@tier}/api/geo/#{id}/#{secondary}", :query => options.merge(self.default_options), :format => :json)
82
+ else
83
+ response = self.class.get("/#{@tier}/api/geo", :query => options.merge(self.default_options), :format => :json)
50
84
  end
51
-
52
- response
53
85
  end
54
-
55
- def resource_feed(options={})
56
- response = self.class.get("/#{@api_type}/resource_feed", :query => options.merge(self.default_json_options), :format => :json)["docs"]
86
+
87
+ def events(options={}, secondary=nil)
88
+ id = options.delete(:id)
89
+ parent_resource = options.delete(:parent_resource)
90
+ resource_id = options.delete(:resource_id)
91
+ season_type = options.delete(:season_type) || nil
92
+
93
+ if id && secondary.nil?
94
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/events/#{id}", :query => options.merge(self.default_options), :format => :json)
95
+ elsif id && !secondary.nil?
96
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/events/#{id}/#{secondary}", :query => options.merge(self.default_options), :format => :json)
97
+ elsif id.nil? && !secondary.nil?
98
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/events/#{secondary}", :query => options.merge(self.default_options), :format => :json)
99
+ elsif id.nil? && secondary.nil? && options[:season_type]
100
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/events/#{season_type}", :query => options.merge(self.default_options), :format => :json)
101
+ else
102
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/events", :query => options.merge(self.default_options), :format => :json)
103
+ end
57
104
  end
58
-
59
- def get_article(options={})
60
- response = self.class.get("/#{@api_type}/get_article", :query => options.merge(self.default_xml_options))
105
+
106
+ def content(options={}, secondary=nil)
107
+ id = options.delete(:id)
108
+ parent_resource = options.delete(:parent_resource)
109
+ resource_id = options.delete(:resource_id)
110
+ content_filter = options.delete(:filter) || nil
111
+
112
+ if id && secondary.nil?
113
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/content/#{id}", :query => options.merge(self.default_options), :format => :json)
114
+ elsif id && !secondary.nil?
115
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}}/content/#{id}/#{secondary}", :query => options.merge(self.default_options), :format => :json)
116
+ elsif id.nil? && secondary.nil? && !content_filter.nil?
117
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/content/#{filter}", :query => options.merge(self.default_options), :format => :json)
118
+ else
119
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/content", :query => options.merge(self.default_options), :format => :json)
120
+ end
61
121
  end
62
-
63
- def recap(options={})
64
- response = self.class.get("/#{@api_type}/recap", :query => options.merge(self.default_xml_options))
122
+
123
+ def sources(options={})
124
+ id = options.delete(:id)
125
+ parent_resource = options.delete(:parent_resource)
126
+ resource_id = options.delete(:resource_id)
127
+
128
+ if id
129
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/sources/#{id}", :query => options.merge(self.default_options), :format => :json)
130
+ else
131
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/sources", :query => options.merge(self.default_options), :format => :json)
132
+ end
65
133
  end
66
-
67
- def boxscore(options={})
68
- response = self.class.get("/#{@api_type}/boxscore", :query => options.merge(self.default_json_options), :format => :json)
134
+
135
+ def trending(options={}, secondary=nil)
136
+ parent_resource = options.delete(:parent_resource)
137
+ resource_id = options.delete(:resource_id)
138
+
139
+ if !secondary.nil?
140
+ response = self.class.get("/#{@tier}/api/#{parent_resource}/#{resource_id}/#{secondary}", :query => options.merge(self.default_options), :format => :json)
141
+ end
69
142
  end
70
143
 
71
144
  protected
72
145
 
73
- def default_json_options
74
- {:appid => @api_key, :format => :json}
75
- end
76
-
77
- def default_xml_options
78
- {:appid => @api_key}
146
+ def default_options
147
+ {:api_key => @api_key}
79
148
  end
80
149
 
81
150
  end
@@ -0,0 +1,3 @@
1
+ module Fanfeedr
2
+ VERSION = "0.2.0"
3
+ end
Binary file
@@ -0,0 +1,172 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fanfeedr::Client do
4
+
5
+ context 'requesting leagues' do
6
+ use_vcr_cassette 'leagues'
7
+
8
+ it 'should initialize with an api_key' do
9
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
10
+ @client.api_key.should == "foobar"
11
+ end
12
+
13
+ it 'should return all leagues' do
14
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
15
+ @leagues = @client.leagues
16
+ @leagues.size.should == 45
17
+ end
18
+
19
+ it 'should return one league' do
20
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
21
+ @league = @client.leagues(:id => "20f0857f-3c43-5f50-acfc-879f838ee853")
22
+ @league.should == {"sport"=>"Baseball", "name"=>"MLB", "gender"=>"M", "id"=>"20f0857f-3c43-5f50-acfc-879f838ee853", "levels"=>["professional"]}
23
+ end
24
+ end
25
+
26
+ context "requesting conferences" do
27
+ use_vcr_cassette 'conferences'
28
+
29
+ before do
30
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
31
+ end
32
+
33
+ it 'should return all conferences' do
34
+ @conferences = @client.conferences(:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853")
35
+ @conferences.size.should == 2
36
+ end
37
+
38
+ it 'should return one conference' do
39
+ @conference = @client.conferences(:id => "384fbe7c-7694-51e8-bf0a-7d0d63ba9211", :parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853")
40
+ @conference.should == {"id"=>"384fbe7c-7694-51e8-bf0a-7d0d63ba9211", "level"=>"professional", "name"=>"National League"}
41
+ end
42
+ end
43
+
44
+ context "requesting divisions" do
45
+ use_vcr_cassette 'divisions'
46
+
47
+ before do
48
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
49
+ end
50
+
51
+ it 'should return all divisions' do
52
+ @divisions = @client.divisions(:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853")
53
+ @divisions.size.should == 6
54
+ end
55
+ end
56
+
57
+ context "requesting teams" do
58
+ use_vcr_cassette 'teams'
59
+
60
+ before do
61
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
62
+ end
63
+
64
+ it 'should return all teams' do
65
+ @teams = @client.teams(:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853")
66
+ @teams.size.should == 30
67
+ end
68
+ end
69
+
70
+ context "requesting persons" do
71
+ use_vcr_cassette 'persons'
72
+
73
+ before do
74
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
75
+ end
76
+
77
+ it 'should return all persons' do
78
+ @persons = @client.persons(:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853")
79
+ @persons.should_not be_nil
80
+ end
81
+ end
82
+
83
+ context 'geo' do
84
+ use_vcr_cassette 'geo'
85
+
86
+ before do
87
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
88
+ end
89
+
90
+ it 'should return all geo with query' do
91
+ @geo = @client.geo(:q => "dallas")
92
+ @geo.should_not be_nil
93
+ end
94
+ end
95
+
96
+ context "requesting events" do
97
+ use_vcr_cassette 'events'
98
+
99
+ before do
100
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
101
+ end
102
+
103
+ it 'should return all events' do
104
+ @events = @client.events(:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853")
105
+ @events.size.should == 2
106
+ end
107
+
108
+ it 'should return all events for today' do
109
+ @events = @client.events({:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853"}, "today")
110
+ @events.should_not be_nil
111
+ end
112
+
113
+ it 'should return all events for next two weeks' do
114
+ @events = @client.events({:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853"}, "next")
115
+ @events.should_not be_nil
116
+ end
117
+
118
+ it 'should return all events for last two weeks' do
119
+ @events = @client.events({:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853"}, "last")
120
+ @events.should_not be_nil
121
+ end
122
+
123
+ it 'should return all events for season_type' do
124
+ @events = @client.events(:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853", :season_type => "postseason")
125
+ @events.should_not be_nil
126
+ end
127
+ end
128
+
129
+ context "requesting content" do
130
+ use_vcr_cassette 'content'
131
+
132
+ before do
133
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
134
+ end
135
+
136
+ it 'should return all content' do
137
+ @content = @client.content(:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853")
138
+ @content.should_not be_nil
139
+ end
140
+ end
141
+
142
+ context "requesting sources" do
143
+ use_vcr_cassette 'sources'
144
+
145
+ before do
146
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
147
+ end
148
+
149
+ it 'should return all sources' do
150
+ @sources = @client.sources(:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853")
151
+ @sources.should_not be_nil
152
+ end
153
+ end
154
+
155
+ context "requesting trending" do
156
+ use_vcr_cassette 'trending'
157
+
158
+ before do
159
+ @client = Fanfeedr::Client.new(:api_key => "foobar", :tier => "basic")
160
+ end
161
+
162
+ it 'should return all trending for team' do
163
+ @trending = @client.trending({:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853"}, "teams")
164
+ @trending.should_not be_nil
165
+ end
166
+
167
+ it 'should return all trending for persons' do
168
+ @trending = @client.trending({:parent_resource => "leagues", :resource_id => "20f0857f-3c43-5f50-acfc-879f838ee853"}, "persons")
169
+ @trending.should_not be_nil
170
+ end
171
+ end
172
+ end