danieljohnmorris-awesome-events 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 0
4
+ :patch: 1
@@ -0,0 +1,13 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ # dependancies
5
+ require 'rubygems'
6
+ require 'open-uri'
7
+ require 'hpricot'
8
+
9
+ # lib
10
+ require 'util/util'
11
+ require 'upcoming/group'
12
+
13
+ include AwesomeEvents
@@ -0,0 +1,19 @@
1
+ module AwesomeEvents
2
+ module Upcoming
3
+ class Group
4
+ attr_accessor :id, :api_key
5
+
6
+ def initialize(options = {})
7
+ @id = options[:id] if options[:id]
8
+ @api_key = options[:api_key] if options[:api_key]
9
+ end
10
+
11
+ def fetch_events(options = {:tense => :upcoming})
12
+ url = "http://upcoming.yahooapis.com/services/rest/?api_key=#{@api_key}&method=group.getEvents&group_id=#{@id}"
13
+ url << "&show_past=1" if options[:tense] == :past
14
+
15
+ AwesomeEvents::Util.get(url)
16
+ end
17
+ end
18
+ end
19
+ end
data/lib/util/util.rb ADDED
@@ -0,0 +1,7 @@
1
+ module AwesomeEvents
2
+ module Util
3
+ def self.get(url)
4
+ doc = Hpricot(open(url))
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class AwesomeEventsTest < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+ require 'mocha'
5
+
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'awesome_events'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danieljohnmorris-awesome-events
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Morris
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-03 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: TODO
17
+ email: daniel.john.morris@googlemail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - VERSION.yml
26
+ - lib/awesome_events.rb
27
+ - lib/upcoming
28
+ - lib/upcoming/group.rb
29
+ - lib/util
30
+ - lib/util/util.rb
31
+ - test/awesome_events_test.rb
32
+ - test/test_helper.rb
33
+ has_rdoc: true
34
+ homepage: http://github.com/danieljohnmorris/awesome-events
35
+ post_install_message:
36
+ rdoc_options:
37
+ - --inline-source
38
+ - --charset=UTF-8
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ requirements: []
54
+
55
+ rubyforge_project:
56
+ rubygems_version: 1.2.0
57
+ signing_key:
58
+ specification_version: 2
59
+ summary: TODO
60
+ test_files: []
61
+