Module: Xmlstats
- Defined in:
- lib/xmlstats.rb,
lib/xmlstats/object.rb,
lib/xmlstats/version.rb,
lib/xmlstats/endpoint.rb,
lib/xmlstats/cachers/redis.rb,
lib/xmlstats/cachers/memory.rb,
lib/xmlstats/http_getters/net_http.rb
Defined Under Namespace
Modules: Cachers, Endpoint, Endpoints, HttpGetters, Objects Classes: Object
Constant Summary collapse
- VERSION =
"1.6.1"
Class Method Summary collapse
-
.api_key ⇒ Object
Manage api key.
- .api_key=(api_key) ⇒ Object
-
.cacher ⇒ Object
Manage cacher.
- .cacher=(cacher) ⇒ Object
-
.contact_info ⇒ Object
Manage contact info.
- .contact_info=(contact_info) ⇒ Object
-
.events(*args) ⇒ Object
Wrapper methods to each endpoint.
-
.http_getter ⇒ Object
Manage http getter.
- .http_getter=(http_getter) ⇒ Object
- .mlb_box_score(*args) ⇒ Object
- .mlb_standing(*args) ⇒ Object
- .mlb_team_results(*args) ⇒ Object
- .mlb_teams(*args) ⇒ Object
- .mlb_wild_card_standing(*args) ⇒ Object
- .nba_box_score(*args) ⇒ Object
- .nba_leaders(*args) ⇒ Object
- .nba_roster(*args) ⇒ Object
- .nba_standing(*args) ⇒ Object
- .nba_team_results(*args) ⇒ Object
- .nba_teams(*args) ⇒ Object
Class Method Details
.api_key ⇒ Object
Manage api key
50 51 52 |
# File 'lib/xmlstats.rb', line 50 def api_key @api_key ||= ENV["XMLSTATS_API_KEY"] end |
.api_key=(api_key) ⇒ Object
54 55 56 |
# File 'lib/xmlstats.rb', line 54 def api_key= api_key @api_key = api_key end |
.cacher ⇒ Object
Manage cacher
82 83 84 |
# File 'lib/xmlstats.rb', line 82 def cacher @cacher || Xmlstats::Cachers::Memory.new end |
.cacher=(cacher) ⇒ Object
86 87 88 89 90 91 |
# File 'lib/xmlstats.rb', line 86 def cacher= cacher case cacher.class.name when "Redis" then @cacher = Xmlstats::Cachers::Redis.new(cacher) else @cacher = cacher end end |
.contact_info ⇒ Object
Manage contact info
60 61 62 63 64 |
# File 'lib/xmlstats.rb', line 60 def contact_info error = "specify user-agent contact info with: Xmlstats.contact_info = '[email protected]'" @contact_info ||= ENV["XMLSTATS_CONTACT_INFO"] @contact_info or raise(error) end |
.contact_info=(contact_info) ⇒ Object
66 67 68 |
# File 'lib/xmlstats.rb', line 66 def contact_info= contact_info @contact_info = contact_info end |
.events(*args) ⇒ Object
Wrapper methods to each endpoint
95 96 97 |
# File 'lib/xmlstats.rb', line 95 def events *args Xmlstats::Endpoints::Events.fetch *args end |
.http_getter ⇒ Object
Manage http getter
72 73 74 |
# File 'lib/xmlstats.rb', line 72 def http_getter @http_getter || Xmlstats::HttpGetters::NetHttp.new end |
.http_getter=(http_getter) ⇒ Object
76 77 78 |
# File 'lib/xmlstats.rb', line 76 def http_getter= http_getter @http_getter = http_getter end |
.mlb_box_score(*args) ⇒ Object
99 100 101 |
# File 'lib/xmlstats.rb', line 99 def mlb_box_score *args Xmlstats::Endpoints::MlbBoxScore.fetch *args end |
.mlb_standing(*args) ⇒ Object
107 108 109 |
# File 'lib/xmlstats.rb', line 107 def mlb_standing *args Xmlstats::Endpoints::MlbStanding.fetch *args end |
.mlb_team_results(*args) ⇒ Object
119 120 121 |
# File 'lib/xmlstats.rb', line 119 def mlb_team_results *args Xmlstats::Endpoints::MlbTeamResults.fetch *args end |
.mlb_teams(*args) ⇒ Object
127 128 129 |
# File 'lib/xmlstats.rb', line 127 def mlb_teams *args Xmlstats::Endpoints::MlbTeams.fetch *args end |
.mlb_wild_card_standing(*args) ⇒ Object
115 116 117 |
# File 'lib/xmlstats.rb', line 115 def mlb_wild_card_standing *args Xmlstats::Endpoints::MlbWildCardStanding.fetch *args end |
.nba_box_score(*args) ⇒ Object
103 104 105 |
# File 'lib/xmlstats.rb', line 103 def nba_box_score *args Xmlstats::Endpoints::NbaBoxScore.fetch *args end |
.nba_leaders(*args) ⇒ Object
135 136 137 |
# File 'lib/xmlstats.rb', line 135 def nba_leaders *args Xmlstats::Endpoints::NbaLeaders.fetch *args end |
.nba_roster(*args) ⇒ Object
139 140 141 |
# File 'lib/xmlstats.rb', line 139 def nba_roster *args Xmlstats::Endpoints::NbaRoster.fetch *args end |
.nba_standing(*args) ⇒ Object
111 112 113 |
# File 'lib/xmlstats.rb', line 111 def nba_standing *args Xmlstats::Endpoints::NbaStanding.fetch *args end |
.nba_team_results(*args) ⇒ Object
123 124 125 |
# File 'lib/xmlstats.rb', line 123 def nba_team_results *args Xmlstats::Endpoints::NbaTeamResults.fetch *args end |