xmlstats 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/examples/events_today.rb +19 -0
- data/lib/xmlstats/version.rb +1 -1
- data/lib/xmlstats.rb +2 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b31c84b7c1f9671819850ab76351b19c8efa673c
|
4
|
+
data.tar.gz: fe6157c6daf19ec7ff3e65f2b492333b820dd707
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b4b3a9ceaaa0d3fa8da0a04273196c48e7c37881f85bf1a0f5cc1576a62c440d0e5a70675585cc3cfe5193154954a53f764591832c6ce300f5bab38a91929dc
|
7
|
+
data.tar.gz: f1ba997f1c0905e52620d6ed526fb29cbe0aa1adb10d1a6e46e1dfa5057267df79160775cadeb8d0a64f8b6c397ec33d1fd52b916fd022c7526eea8b8700cb08
|
data/README.md
CHANGED
@@ -26,6 +26,13 @@ Configuration
|
|
26
26
|
Configure xmlstats-ruby as follows with your API key and contact info. The
|
27
27
|
contact info is used in the User-Agent string.
|
28
28
|
|
29
|
+
You can choose to set this via environment variables:
|
30
|
+
|
31
|
+
export XMLSTATS_API_KEY="my api key"
|
32
|
+
export XMLSTATS_CONTACT_INFO="alex@anticlever.com"
|
33
|
+
|
34
|
+
Or in Ruby:
|
35
|
+
|
29
36
|
Xmlstats.api_key = "my api key"
|
30
37
|
Xmlstats.contact_info = "alex@anticlever.com"
|
31
38
|
|
@@ -39,6 +46,11 @@ The cacher can be any object which responds to the get(key) and set(key, value)
|
|
39
46
|
methods. The Redis cacher will automatically expire keys after 1 hour. The
|
40
47
|
memory cacher never expires keys.
|
41
48
|
|
49
|
+
The Redis cacher can accept a hash for options which will be passed to
|
50
|
+
Redis.new, or a previously instantiated Redis object. Note that this gem does
|
51
|
+
not depend on the redis gem, so you will need to add that as your own
|
52
|
+
dependency if you choose to use that cacher.
|
53
|
+
|
42
54
|
Usage
|
43
55
|
-----
|
44
56
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "xmlstats"
|
3
|
+
require "date"
|
4
|
+
|
5
|
+
Xmlstats.api_key = ENV["XMLSTATS_API_KEY"]
|
6
|
+
Xmlstats.contact_info = ENV["XMLSTATS_CONTACT_INFO"] || "alex@anticlever.com"
|
7
|
+
|
8
|
+
date = Date.today
|
9
|
+
|
10
|
+
printf("Events on %s\n\n", date.strftime("%A, %B %e, %Y"));
|
11
|
+
printf("%-35s %5s %34s\n", "Time", "Event", "Status");
|
12
|
+
|
13
|
+
Xmlstats.events(date).each do |event|
|
14
|
+
printf("%-12s %24s vs. %-24s %9s\n",
|
15
|
+
event.start_date_time.strftime("%l:%M %p"),
|
16
|
+
event.away_team.full_name,
|
17
|
+
event.home_team.full_name,
|
18
|
+
event.event_status)
|
19
|
+
end
|
data/lib/xmlstats/version.rb
CHANGED
data/lib/xmlstats.rb
CHANGED
@@ -42,7 +42,7 @@ require "xmlstats/endpoints/nba_leaders"
|
|
42
42
|
module Xmlstats
|
43
43
|
|
44
44
|
def self.api_key
|
45
|
-
@api_key
|
45
|
+
@api_key ||= ENV["XMLSTATS_API_KEY"]
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.api_key= api_key
|
@@ -51,6 +51,7 @@ module Xmlstats
|
|
51
51
|
|
52
52
|
def self.contact_info
|
53
53
|
error = "specify user-agent contact info with: Xmlstats.contact_info = 'you@example.com'"
|
54
|
+
@contact_info ||= ENV["XMLSTATS_CONTACT_INFO"]
|
54
55
|
@contact_info or raise(error)
|
55
56
|
end
|
56
57
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmlstats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex McHale
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- LICENSE.txt
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
|
+
- examples/events_today.rb
|
53
54
|
- lib/xmlstats.rb
|
54
55
|
- lib/xmlstats/cachers/memory.rb
|
55
56
|
- lib/xmlstats/cachers/redis.rb
|