mlb 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,11 +1,8 @@
1
1
  = MLB.rb
2
2
  ==== MLB.rb is a Ruby library for retrieving current Major League Baseball players, managers, teams, divisions, and leagues.
3
-
4
- === Get it
5
- At the command prompt, type:
6
- gem install mlb -s http://gemcutter.org
7
-
8
- === Use it
3
+ == Installation
4
+ $ gem install mlb -s http://gemcutter.org
5
+ == Usage
9
6
  $ irb
10
7
  >> require 'mlb'
11
8
  >> MLB.teams.first.name # => "Arizona Diamondbacks"
@@ -21,8 +18,7 @@ At the command prompt, type:
21
18
  >> MLB.teams.first.players.first.name # => "Alex Romero"
22
19
  >> MLB.teams.first.players.first.number # => 28
23
20
  >> MLB.teams.first.players.first.position # => "Right fielder"
24
-
25
- === Acknowledgements
21
+ == Acknowledgements
26
22
  Many thanks to:
27
23
  * Freebase[http://www.freebase.com]
28
24
  * httparty[http://github.com/jnunemaker/httparty]
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ AUTHOR = "Erik Michaels-Ober"
8
8
  EMAIL = "sferik@gmail.com"
9
9
  HOMEPAGE = "http://github.com/sferik/mlb"
10
10
  SUMMARY = "MLB.rb is a Ruby library for retrieving current Major League Baseball players, managers, teams, divisions, and leagues."
11
- GEM_VERSION = "0.0.4"
11
+ GEM_VERSION = "0.0.5"
12
12
 
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.name = GEM_NAME
data/lib/mlb.rb CHANGED
@@ -22,11 +22,10 @@ class MLB
22
22
  # MLB.teams.first.players.first.number # => 28
23
23
  # MLB.teams.first.players.first.position # => "Right fielder"
24
24
  def self.teams
25
- format :json
26
25
  @query ||= team_query
27
- @response ||= exec_mql(@query)
26
+ @response ||= exec_query(@query)
28
27
  @results ||= []
29
- if @results.empty?
28
+ if @response && @results.empty?
30
29
  @response['result'].each do |result|
31
30
  @results << OpenStruct.new({
32
31
  :name => result['name'],
@@ -54,16 +53,16 @@ class MLB
54
53
 
55
54
  private
56
55
 
57
- # Converts MQL query to JSON and sends to Freebase API
58
- def self.exec_mql(query)
56
+ # Converts MQL query to JSON and fetches response from Freebase API
57
+ def self.exec_query(query)
58
+ format :json
59
59
  begin
60
- response ||= get('/service/mqlread?', :query => {:query => query.to_json})
61
- unless response['code'] == '/api/status/ok'
62
- errors = Array(response['messages']).map{|m| m.inspect}.join(', ')
63
- raise "#{response['status']}: #{errors} (#{response['transaction_id']})"
60
+ response = get('/service/mqlread?', :query => {:query => query.to_json})
61
+ if response['code'] != '/api/status/ok'
62
+ error("#{response['status']} (Transaction: #{response['transaction_id']})")
64
63
  end
65
64
  rescue SocketError, Errno::ECONNREFUSED => e
66
- raise Exception.new("Could not connect. Unclog tubes and try again.")
65
+ error("Could not connect. Unclog tubes and try again.")
67
66
  end
68
67
  response
69
68
  end
@@ -117,4 +116,8 @@ class MLB
117
116
  }
118
117
  end
119
118
 
119
+ def self.error(*messages)
120
+ puts messages.map{|msg| "\033[1;31mError: #{msg}\033[0m"}
121
+ end
122
+
120
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mlb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Michaels-Ober
@@ -45,16 +45,6 @@ files:
45
45
  - LICENSE
46
46
  - README.rdoc
47
47
  - Rakefile
48
- - doc/classes/MLB.html
49
- - doc/created.rid
50
- - doc/files/lib/mlb_rb.html
51
- - doc/files/LICENSE.html
52
- - doc/files/README_rdoc.html
53
- - doc/fr_class_index.html
54
- - doc/fr_file_index.html
55
- - doc/fr_method_index.html
56
- - doc/index.html
57
- - doc/rdoc-style.css
58
48
  - lib/mlb.rb
59
49
  has_rdoc: true
60
50
  homepage: http://github.com/sferik/mlb
data/doc/classes/MLB.html DELETED
@@ -1,308 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: MLB</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">MLB</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/mlb_rb.html">
59
- lib/mlb.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Object
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
-
82
-
83
- </div>
84
-
85
- <div id="method-list">
86
- <h3 class="section-bar">Methods</h3>
87
-
88
- <div class="name-list">
89
- <a href="#M000002">exec_mql</a>&nbsp;&nbsp;
90
- <a href="#M000003">team_query</a>&nbsp;&nbsp;
91
- <a href="#M000001">teams</a>&nbsp;&nbsp;
92
- </div>
93
- </div>
94
-
95
- </div>
96
-
97
-
98
- <!-- if includes -->
99
- <div id="includes">
100
- <h3 class="section-bar">Included Modules</h3>
101
-
102
- <div id="includes-list">
103
- <span class="include-name">HTTParty</span>
104
- </div>
105
- </div>
106
-
107
- <div id="section">
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
- <!-- if method_list -->
117
- <div id="methods">
118
- <h3 class="section-bar">Public Class methods</h3>
119
-
120
- <div id="method-M000001" class="method-detail">
121
- <a name="M000001"></a>
122
-
123
- <div class="method-heading">
124
- <a href="#M000001" class="method-signature">
125
- <span class="method-name">teams</span><span class="method-args">()</span>
126
- </a>
127
- </div>
128
-
129
- <div class="method-description">
130
- <p>
131
- Returns an array of objects, one for each Major League Baseball team
132
- </p>
133
- <pre>
134
- MLB.teams.first.name # =&gt; &quot;Arizona Diamondbacks&quot;
135
- MLB.teams.first.league # =&gt; &quot;National League&quot;
136
- MLB.teams.first.division # =&gt; &quot;National League West&quot;
137
- MLB.teams.first.manager # =&gt; &quot;Bob Melvin&quot;
138
- MLB.teams.first.wins # =&gt; 82
139
- MLB.teams.first.losses # =&gt; 80
140
- MLB.teams.first.founded # =&gt; 1998
141
- MLB.teams.first.mascot # =&gt; nil
142
- MLB.teams.first.ballpark # =&gt; &quot;Chase Field&quot;
143
- MLB.teams.first.logo_url # =&gt; &quot;http://img.freebase.com/api/trans/image_thumb/wikipedia/images/en_id/13104064&quot;
144
- MLB.teams.first.players.first.name # =&gt; &quot;Alex Romero&quot;
145
- MLB.teams.first.players.first.number # =&gt; 28
146
- MLB.teams.first.players.first.position # =&gt; &quot;Right fielder&quot;
147
- </pre>
148
- <p><a class="source-toggle" href="#"
149
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
150
- <div class="method-source-code" id="M000001-source">
151
- <pre>
152
- <span class="ruby-comment cmt"># File lib/mlb.rb, line 24</span>
153
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">teams</span>
154
- <span class="ruby-identifier">format</span> <span class="ruby-identifier">:json</span>
155
- <span class="ruby-ivar">@query</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">team_query</span>
156
- <span class="ruby-ivar">@response</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">exec_mql</span>(<span class="ruby-ivar">@query</span>)
157
- <span class="ruby-ivar">@results</span> <span class="ruby-operator">||=</span> []
158
- <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@results</span>.<span class="ruby-identifier">empty?</span>
159
- <span class="ruby-ivar">@response</span>[<span class="ruby-value str">'result'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">result</span><span class="ruby-operator">|</span>
160
- <span class="ruby-ivar">@results</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>({
161
- <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">result</span>[<span class="ruby-value str">'name'</span>],
162
- <span class="ruby-identifier">:league</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">result</span>[<span class="ruby-value str">'league'</span>][<span class="ruby-value str">'name'</span>],
163
- <span class="ruby-identifier">:division</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">result</span>[<span class="ruby-value str">'division'</span>][<span class="ruby-value str">'name'</span>],
164
- <span class="ruby-identifier">:manager</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">result</span>[<span class="ruby-value str">'current_manager'</span>][<span class="ruby-value str">'name'</span>],
165
- <span class="ruby-identifier">:wins</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">result</span>[<span class="ruby-value str">'team_stats'</span>].<span class="ruby-identifier">first</span>[<span class="ruby-value str">'wins'</span>].<span class="ruby-identifier">to_i</span>,
166
- <span class="ruby-identifier">:losses</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">result</span>[<span class="ruby-value str">'team_stats'</span>].<span class="ruby-identifier">first</span>[<span class="ruby-value str">'losses'</span>].<span class="ruby-identifier">to_i</span>,
167
- <span class="ruby-identifier">:founded</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">result</span>[<span class="ruby-value str">'/sports/sports_team/founded'</span>].<span class="ruby-identifier">first</span>[<span class="ruby-value str">'value'</span>].<span class="ruby-identifier">to_i</span>,
168
- <span class="ruby-identifier">:mascot</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">result</span>[<span class="ruby-value str">'/sports/sports_team/team_mascot'</span>].<span class="ruby-identifier">first</span> <span class="ruby-value">? </span><span class="ruby-identifier">result</span>[<span class="ruby-value str">'/sports/sports_team/team_mascot'</span>].<span class="ruby-identifier">first</span>[<span class="ruby-value str">'name'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>),
169
- <span class="ruby-identifier">:ballpark</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">result</span>[<span class="ruby-value str">'/sports/sports_team/arena_stadium'</span>].<span class="ruby-identifier">first</span>[<span class="ruby-value str">'name'</span>],
170
- <span class="ruby-identifier">:logo_url</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://img.freebase.com/api/trans/image_thumb'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">result</span>[<span class="ruby-value str">'/common/topic/image'</span>].<span class="ruby-identifier">first</span>[<span class="ruby-value str">'id'</span>],
171
- <span class="ruby-identifier">:players</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">result</span>[<span class="ruby-value str">'current_roster'</span>].<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">player</span><span class="ruby-operator">|</span>
172
- <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>({
173
- <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">player</span>[<span class="ruby-value str">'player'</span>],
174
- <span class="ruby-identifier">:number</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">player</span>[<span class="ruby-value str">'number'</span>],
175
- <span class="ruby-identifier">:position</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">player</span>[<span class="ruby-value str">'position'</span>],
176
- })
177
- },
178
- })
179
- <span class="ruby-keyword kw">end</span>
180
- <span class="ruby-keyword kw">end</span>
181
- <span class="ruby-ivar">@results</span>
182
- <span class="ruby-keyword kw">end</span>
183
- </pre>
184
- </div>
185
- </div>
186
- </div>
187
-
188
- <h3 class="section-bar">Private Class methods</h3>
189
-
190
- <div id="method-M000002" class="method-detail">
191
- <a name="M000002"></a>
192
-
193
- <div class="method-heading">
194
- <a href="#M000002" class="method-signature">
195
- <span class="method-name">exec_mql</span><span class="method-args">(query)</span>
196
- </a>
197
- </div>
198
-
199
- <div class="method-description">
200
- <p>
201
- Converts MQL query to JSON and sends to Freebase API
202
- </p>
203
- <p><a class="source-toggle" href="#"
204
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
205
- <div class="method-source-code" id="M000002-source">
206
- <pre>
207
- <span class="ruby-comment cmt"># File lib/mlb.rb, line 58</span>
208
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">exec_mql</span>(<span class="ruby-identifier">query</span>)
209
- <span class="ruby-keyword kw">begin</span>
210
- <span class="ruby-identifier">response</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">get</span>(<span class="ruby-value str">'/service/mqlread?'</span>, <span class="ruby-identifier">:query</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-identifier">:query</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">query</span>.<span class="ruby-identifier">to_json</span>})
211
- <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">response</span>[<span class="ruby-value str">'code'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'/api/status/ok'</span>
212
- <span class="ruby-identifier">errors</span> = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">response</span>[<span class="ruby-value str">'messages'</span>]).<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">inspect</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-value str">', '</span>)
213
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{response['status']}: #{errors} (#{response['transaction_id']})&quot;</span>
214
- <span class="ruby-keyword kw">end</span>
215
- <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SocketError</span>, <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNREFUSED</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
216
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">Exception</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;Could not connect. Unclog tubes and try again.&quot;</span>)
217
- <span class="ruby-keyword kw">end</span>
218
- <span class="ruby-identifier">response</span>
219
- <span class="ruby-keyword kw">end</span>
220
- </pre>
221
- </div>
222
- </div>
223
- </div>
224
-
225
- <div id="method-M000003" class="method-detail">
226
- <a name="M000003"></a>
227
-
228
- <div class="method-heading">
229
- <a href="#M000003" class="method-signature">
230
- <span class="method-name">team_query</span><span class="method-args">()</span>
231
- </a>
232
- </div>
233
-
234
- <div class="method-description">
235
- <p>
236
- Returns the MQL query for <a href="MLB.html#M000001">teams</a>, as a Ruby
237
- hash
238
- </p>
239
- <p><a class="source-toggle" href="#"
240
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
241
- <div class="method-source-code" id="M000003-source">
242
- <pre>
243
- <span class="ruby-comment cmt"># File lib/mlb.rb, line 72</span>
244
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">team_query</span>
245
- {
246
- <span class="ruby-identifier">:query</span> =<span class="ruby-operator">&gt;</span> [
247
- {
248
- <span class="ruby-value str">'name'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
249
- <span class="ruby-value str">'league'</span> =<span class="ruby-operator">&gt;</span> {
250
- <span class="ruby-value str">'name'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
251
- },
252
- <span class="ruby-value str">'division'</span> =<span class="ruby-operator">&gt;</span> {
253
- <span class="ruby-value str">'name'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
254
- },
255
- <span class="ruby-value str">'current_manager'</span> =<span class="ruby-operator">&gt;</span> {
256
- <span class="ruby-value str">'name'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
257
- },
258
- <span class="ruby-value str">'team_stats'</span> =<span class="ruby-operator">&gt;</span> [{
259
- <span class="ruby-value str">'wins'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
260
- <span class="ruby-value str">'losses'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
261
- <span class="ruby-value str">'season'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
262
- <span class="ruby-value str">'limit'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>,
263
- <span class="ruby-value str">'sort'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-season'</span>,
264
- }],
265
- <span class="ruby-value str">'current_roster'</span> =<span class="ruby-operator">&gt;</span> [{
266
- <span class="ruby-value str">'player'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
267
- <span class="ruby-value str">'position'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
268
- <span class="ruby-value str">'number'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
269
- <span class="ruby-value str">'sort'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'player'</span>,
270
- }],
271
- <span class="ruby-value str">'/sports/sports_team/founded'</span> =<span class="ruby-operator">&gt;</span> [{
272
- <span class="ruby-value str">'value'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
273
- }],
274
- <span class="ruby-value str">'/sports/sports_team/team_mascot'</span> =<span class="ruby-operator">&gt;</span> [{
275
- }],
276
- <span class="ruby-value str">'/sports/sports_team/arena_stadium'</span> =<span class="ruby-operator">&gt;</span> [{
277
- <span class="ruby-value str">'name'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
278
- }],
279
- <span class="ruby-value str">'/common/topic/image'</span> =<span class="ruby-operator">&gt;</span> [{
280
- <span class="ruby-value str">'id'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
281
- <span class="ruby-value str">'timestamp'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
282
- <span class="ruby-value str">'sort'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-timestamp'</span>,
283
- <span class="ruby-value str">'limit'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>,
284
- }],
285
- <span class="ruby-value str">'sort'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'name'</span>,
286
- <span class="ruby-value str">'type'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'/baseball/baseball_team'</span>,
287
- }
288
- ]
289
- }
290
- <span class="ruby-keyword kw">end</span>
291
- </pre>
292
- </div>
293
- </div>
294
- </div>
295
-
296
-
297
- </div>
298
-
299
-
300
- </div>
301
-
302
-
303
- <div id="validator-badges">
304
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
305
- </div>
306
-
307
- </body>
308
- </html>
data/doc/created.rid DELETED
@@ -1 +0,0 @@
1
- Fri, 16 Oct 2009 16:33:38 -0700
@@ -1,129 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: LICENSE</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>LICENSE</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>LICENSE
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Mon Oct 05 22:39:47 -0700 2009</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <p>
73
- Copyright (c) 2009 Erik Michaels-Ober
74
- </p>
75
- <p>
76
- Permission is hereby granted, free of charge, to any person obtaining a
77
- copy of this software and associated documentation files (the
78
- &quot;Software&quot;), to deal in the Software without restriction,
79
- including without limitation the rights to use, copy, modify, merge,
80
- publish, distribute, sublicense, and/or sell copies of the Software, and to
81
- permit persons to whom the Software is furnished to do so, subject to the
82
- following conditions:
83
- </p>
84
- <p>
85
- The above copyright notice and this permission notice shall be included in
86
- all copies or substantial portions of the Software.
87
- </p>
88
- <p>
89
- THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
90
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
91
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
92
- NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
93
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
94
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
95
- USE OR OTHER DEALINGS IN THE SOFTWARE.
96
- </p>
97
-
98
- </div>
99
-
100
-
101
- </div>
102
-
103
-
104
- </div>
105
-
106
-
107
- <!-- if includes -->
108
-
109
- <div id="section">
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
- <!-- if method_list -->
119
-
120
-
121
- </div>
122
-
123
-
124
- <div id="validator-badges">
125
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
126
- </div>
127
-
128
- </body>
129
- </html>
@@ -1,146 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: README.rdoc</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>README.rdoc</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>README.rdoc
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Fri Oct 16 16:27:40 -0700 2009</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <h1>MLB.rb</h1>
73
- <h4>MLB.rb is a Ruby library for retrieving current Major League Baseball players, managers, teams, divisions, and leagues.</h4>
74
- <h3>Get it</h3>
75
- <p>
76
- At the command prompt, type:
77
- </p>
78
- <pre>
79
- gem install mlb -s http://gemcutter.org
80
- </pre>
81
- <h3>Use it</h3>
82
- <pre>
83
- $ irb
84
- &gt;&gt; require 'mlb'
85
- &gt;&gt; MLB.teams.first.name # =&gt; &quot;Arizona Diamondbacks&quot;
86
- &gt;&gt; MLB.teams.first.league # =&gt; &quot;National League&quot;
87
- &gt;&gt; MLB.teams.first.division # =&gt; &quot;National League West&quot;
88
- &gt;&gt; MLB.teams.first.manager # =&gt; &quot;Bob Melvin&quot;
89
- &gt;&gt; MLB.teams.first.wins # =&gt; 82
90
- &gt;&gt; MLB.teams.first.losses # =&gt; 80
91
- &gt;&gt; MLB.teams.first.founded # =&gt; 1998
92
- &gt;&gt; MLB.teams.first.mascot # =&gt; nil
93
- &gt;&gt; MLB.teams.first.ballpark # =&gt; &quot;Chase Field&quot;
94
- &gt;&gt; MLB.teams.first.logo_url # =&gt; &quot;http://img.freebase.com/api/trans/image_thumb/wikipedia/images/en_id/13104064&quot;
95
- &gt;&gt; MLB.teams.first.players.first.name # =&gt; &quot;Alex Romero&quot;
96
- &gt;&gt; MLB.teams.first.players.first.number # =&gt; 28
97
- &gt;&gt; MLB.teams.first.players.first.position # =&gt; &quot;Right fielder&quot;
98
- </pre>
99
- <h3>Acknowledgements</h3>
100
- <p>
101
- Many thanks to:
102
- </p>
103
- <ul>
104
- <li><a href="http://www.freebase.com">Freebase</a>
105
-
106
- </li>
107
- <li><a href="http://github.com/jnunemaker/httparty">httparty</a>
108
-
109
- </li>
110
- </ul>
111
- <p>
112
- Also, thanks to <a href="http://www.21st-amendment.com">beer</a>.
113
- </p>
114
-
115
- </div>
116
-
117
-
118
- </div>
119
-
120
-
121
- </div>
122
-
123
-
124
- <!-- if includes -->
125
-
126
- <div id="section">
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
- <!-- if method_list -->
136
-
137
-
138
- </div>
139
-
140
-
141
- <div id="validator-badges">
142
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
143
- </div>
144
-
145
- </body>
146
- </html>
@@ -1,110 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: mlb.rb</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>mlb.rb</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>lib/mlb.rb
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Fri Oct 16 16:21:21 -0700 2009</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
-
72
- <div id="requires-list">
73
- <h3 class="section-bar">Required files</h3>
74
-
75
- <div class="name-list">
76
- httparty&nbsp;&nbsp;
77
- json&nbsp;&nbsp;
78
- ostruct&nbsp;&nbsp;
79
- </div>
80
- </div>
81
-
82
- </div>
83
-
84
-
85
- </div>
86
-
87
-
88
- <!-- if includes -->
89
-
90
- <div id="section">
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
- <!-- if method_list -->
100
-
101
-
102
- </div>
103
-
104
-
105
- <div id="validator-badges">
106
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
107
- </div>
108
-
109
- </body>
110
- </html>
@@ -1,27 +0,0 @@
1
-
2
- <?xml version="1.0" encoding="iso-8859-1"?>
3
- <!DOCTYPE html
4
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
-
7
- <!--
8
-
9
- Classes
10
-
11
- -->
12
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
- <head>
14
- <title>Classes</title>
15
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
- <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
- <base target="docwin" />
18
- </head>
19
- <body>
20
- <div id="index">
21
- <h1 class="section-bar">Classes</h1>
22
- <div id="index-entries">
23
- <a href="classes/MLB.html">MLB</a><br />
24
- </div>
25
- </div>
26
- </body>
27
- </html>
@@ -1,29 +0,0 @@
1
-
2
- <?xml version="1.0" encoding="iso-8859-1"?>
3
- <!DOCTYPE html
4
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
-
7
- <!--
8
-
9
- Files
10
-
11
- -->
12
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
- <head>
14
- <title>Files</title>
15
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
- <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
- <base target="docwin" />
18
- </head>
19
- <body>
20
- <div id="index">
21
- <h1 class="section-bar">Files</h1>
22
- <div id="index-entries">
23
- <a href="files/LICENSE.html">LICENSE</a><br />
24
- <a href="files/README_rdoc.html">README.rdoc</a><br />
25
- <a href="files/lib/mlb_rb.html">lib/mlb.rb</a><br />
26
- </div>
27
- </div>
28
- </body>
29
- </html>
@@ -1,29 +0,0 @@
1
-
2
- <?xml version="1.0" encoding="iso-8859-1"?>
3
- <!DOCTYPE html
4
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
-
7
- <!--
8
-
9
- Methods
10
-
11
- -->
12
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
- <head>
14
- <title>Methods</title>
15
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
- <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
- <base target="docwin" />
18
- </head>
19
- <body>
20
- <div id="index">
21
- <h1 class="section-bar">Methods</h1>
22
- <div id="index-entries">
23
- <a href="classes/MLB.html#M000002">exec_mql (MLB)</a><br />
24
- <a href="classes/MLB.html#M000003">team_query (MLB)</a><br />
25
- <a href="classes/MLB.html#M000001">teams (MLB)</a><br />
26
- </div>
27
- </div>
28
- </body>
29
- </html>
data/doc/index.html DELETED
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
-
6
- <!--
7
-
8
- MLB.rb
9
-
10
- -->
11
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
- <head>
13
- <title>MLB.rb</title>
14
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
- </head>
16
- <frameset rows="20%, 80%">
17
- <frameset cols="25%,35%,45%">
18
- <frame src="fr_file_index.html" title="Files" name="Files" />
19
- <frame src="fr_class_index.html" name="Classes" />
20
- <frame src="fr_method_index.html" name="Methods" />
21
- </frameset>
22
- <frame src="files/README_rdoc.html" name="docwin" />
23
- </frameset>
24
- </html>
data/doc/rdoc-style.css DELETED
@@ -1,208 +0,0 @@
1
-
2
- body {
3
- font-family: Verdana,Arial,Helvetica,sans-serif;
4
- font-size: 90%;
5
- margin: 0;
6
- margin-left: 40px;
7
- padding: 0;
8
- background: white;
9
- }
10
-
11
- h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
- h1 { font-size: 150%; }
13
- h2,h3,h4 { margin-top: 1em; }
14
-
15
- a { background: #eef; color: #039; text-decoration: none; }
16
- a:hover { background: #039; color: #eef; }
17
-
18
- /* Override the base stylesheet's Anchor inside a table cell */
19
- td > a {
20
- background: transparent;
21
- color: #039;
22
- text-decoration: none;
23
- }
24
-
25
- /* and inside a section title */
26
- .section-title > a {
27
- background: transparent;
28
- color: #eee;
29
- text-decoration: none;
30
- }
31
-
32
- /* === Structural elements =================================== */
33
-
34
- div#index {
35
- margin: 0;
36
- margin-left: -40px;
37
- padding: 0;
38
- font-size: 90%;
39
- }
40
-
41
-
42
- div#index a {
43
- margin-left: 0.7em;
44
- }
45
-
46
- div#index .section-bar {
47
- margin-left: 0px;
48
- padding-left: 0.7em;
49
- background: #ccc;
50
- font-size: small;
51
- }
52
-
53
-
54
- div#classHeader, div#fileHeader {
55
- width: auto;
56
- color: white;
57
- padding: 0.5em 1.5em 0.5em 1.5em;
58
- margin: 0;
59
- margin-left: -40px;
60
- border-bottom: 3px solid #006;
61
- }
62
-
63
- div#classHeader a, div#fileHeader a {
64
- background: inherit;
65
- color: white;
66
- }
67
-
68
- div#classHeader td, div#fileHeader td {
69
- background: inherit;
70
- color: white;
71
- }
72
-
73
-
74
- div#fileHeader {
75
- background: #057;
76
- }
77
-
78
- div#classHeader {
79
- background: #048;
80
- }
81
-
82
-
83
- .class-name-in-header {
84
- font-size: 180%;
85
- font-weight: bold;
86
- }
87
-
88
-
89
- div#bodyContent {
90
- padding: 0 1.5em 0 1.5em;
91
- }
92
-
93
- div#description {
94
- padding: 0.5em 1.5em;
95
- background: #efefef;
96
- border: 1px dotted #999;
97
- }
98
-
99
- div#description h1,h2,h3,h4,h5,h6 {
100
- color: #125;;
101
- background: transparent;
102
- }
103
-
104
- div#validator-badges {
105
- text-align: center;
106
- }
107
- div#validator-badges img { border: 0; }
108
-
109
- div#copyright {
110
- color: #333;
111
- background: #efefef;
112
- font: 0.75em sans-serif;
113
- margin-top: 5em;
114
- margin-bottom: 0;
115
- padding: 0.5em 2em;
116
- }
117
-
118
-
119
- /* === Classes =================================== */
120
-
121
- table.header-table {
122
- color: white;
123
- font-size: small;
124
- }
125
-
126
- .type-note {
127
- font-size: small;
128
- color: #DEDEDE;
129
- }
130
-
131
- .xxsection-bar {
132
- background: #eee;
133
- color: #333;
134
- padding: 3px;
135
- }
136
-
137
- .section-bar {
138
- color: #333;
139
- border-bottom: 1px solid #999;
140
- margin-left: -20px;
141
- }
142
-
143
-
144
- .section-title {
145
- background: #79a;
146
- color: #eee;
147
- padding: 3px;
148
- margin-top: 2em;
149
- margin-left: -30px;
150
- border: 1px solid #999;
151
- }
152
-
153
- .top-aligned-row { vertical-align: top }
154
- .bottom-aligned-row { vertical-align: bottom }
155
-
156
- /* --- Context section classes ----------------------- */
157
-
158
- .context-row { }
159
- .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
- .context-item-value { font-size: small; color: #448; }
161
- .context-item-desc { color: #333; padding-left: 2em; }
162
-
163
- /* --- Method classes -------------------------- */
164
- .method-detail {
165
- background: #efefef;
166
- padding: 0;
167
- margin-top: 0.5em;
168
- margin-bottom: 1em;
169
- border: 1px dotted #ccc;
170
- }
171
- .method-heading {
172
- color: black;
173
- background: #ccc;
174
- border-bottom: 1px solid #666;
175
- padding: 0.2em 0.5em 0 0.5em;
176
- }
177
- .method-signature { color: black; background: inherit; }
178
- .method-name { font-weight: bold; }
179
- .method-args { font-style: italic; }
180
- .method-description { padding: 0 0.5em 0 0.5em; }
181
-
182
- /* --- Source code sections -------------------- */
183
-
184
- a.source-toggle { font-size: 90%; }
185
- div.method-source-code {
186
- background: #262626;
187
- color: #ffdead;
188
- margin: 1em;
189
- padding: 0.5em;
190
- border: 1px dashed #999;
191
- overflow: hidden;
192
- }
193
-
194
- div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
-
196
- /* --- Ruby keyword styles --------------------- */
197
-
198
- .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
-
200
- .ruby-constant { color: #7fffd4; background: transparent; }
201
- .ruby-keyword { color: #00ffff; background: transparent; }
202
- .ruby-ivar { color: #eedd82; background: transparent; }
203
- .ruby-operator { color: #00ffee; background: transparent; }
204
- .ruby-identifier { color: #ffdead; background: transparent; }
205
- .ruby-node { color: #ffa07a; background: transparent; }
206
- .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
- .ruby-regexp { color: #ffa07a; background: transparent; }
208
- .ruby-value { color: #7fffd4; background: transparent; }