eventbright 0.1.0

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.
Files changed (37) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.markdown +92 -0
  5. data/Rakefile +52 -0
  6. data/VERSION +1 -0
  7. data/lib/eventbright.rb +5 -0
  8. data/lib/eventbright/api_object.rb +180 -0
  9. data/lib/eventbright/api_object_class_methods.rb +117 -0
  10. data/lib/eventbright/api_object_collection.rb +60 -0
  11. data/lib/eventbright/api_object_relationships.rb +72 -0
  12. data/lib/eventbright/api_objects/attendee.rb +51 -0
  13. data/lib/eventbright/api_objects/discount.rb +62 -0
  14. data/lib/eventbright/api_objects/event.rb +79 -0
  15. data/lib/eventbright/api_objects/organizer.rb +26 -0
  16. data/lib/eventbright/api_objects/ticket.rb +63 -0
  17. data/lib/eventbright/api_objects/user.rb +45 -0
  18. data/lib/eventbright/api_objects/venue.rb +18 -0
  19. data/lib/eventbright/error.rb +14 -0
  20. data/lib/eventbright/main.rb +57 -0
  21. data/spec/eventbright/api_object_class_spec.rb +113 -0
  22. data/spec/eventbright/api_object_collection_spec.rb +67 -0
  23. data/spec/eventbright/api_object_relationship_spec.rb +23 -0
  24. data/spec/eventbright/api_object_spec.rb +15 -0
  25. data/spec/eventbright/user_spec.rb +141 -0
  26. data/spec/eventbright_api_faker.rb +18 -0
  27. data/spec/eventbright_spec.rb +36 -0
  28. data/spec/faked_responses/auth_required.json +1 -0
  29. data/spec/faked_responses/event_get.json +1 -0
  30. data/spec/faked_responses/user_get.json +1 -0
  31. data/spec/faked_responses/user_list_events.json +1 -0
  32. data/spec/faked_responses/user_list_organizers.json +1 -0
  33. data/spec/faked_responses/user_list_venues.json +1 -0
  34. data/spec/faked_responses/user_update.json +1 -0
  35. data/spec/spec.opts +1 -0
  36. data/spec/spec_helper.rb +35 -0
  37. metadata +132 -0
@@ -0,0 +1,18 @@
1
+ def fake_response(call)
2
+ string = ""
3
+ File.open("spec/faked_responses#{call}.json", "r") do |infile|
4
+ while(line = infile.gets)
5
+ string << line
6
+ end
7
+ end
8
+ HTTParty::Response.new(HTTParty::Parser.call(string, :json), string, 200, "")
9
+ end
10
+
11
+
12
+ module EventBright
13
+ class API
14
+ def self.do_post(string, opts = {})
15
+ fake_response(string)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,36 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe EventBright do
4
+ before(:each) do
5
+ EventBright.setup("key")
6
+ end
7
+ it "should have setup method" do
8
+ EventBright.should respond_to(:setup)
9
+ lambda {
10
+ EventBright.setup("key")
11
+ EventBright.setup("key", true)
12
+ }.should_not raise_error
13
+ end
14
+ it "should call httparty with key given to setup" do
15
+ EventBright::API.should_receive(:do_post).with(anything, hash_including(:body => hash_including(:app_key => "key")))
16
+ EventBright.call("event_get", {})
17
+ end
18
+
19
+ it "should have call method" do
20
+ EventBright.should respond_to(:call)
21
+ end
22
+ it "should have debug! method" do
23
+ EventBright.should respond_to(:debug!)
24
+ end
25
+
26
+ it "should replace a user object with a user_key on #call" do
27
+ EventBright::API.should_receive(:do_post).with("/user_get", {:body => {:app_key => "key", "user_key" => "fake_key"}})
28
+ EventBright.call(:user_get, :user => EventBright::User.new("fake_key", true))
29
+ end
30
+
31
+ it "should format time according to eventbright's wrong iso8601" do
32
+ a = "2010-04-01 13:37:00"
33
+ b = Time.parse("4/1/2010 13:37")
34
+ a.should == EventBright.formatted_time(b)
35
+ end
36
+ end
@@ -0,0 +1 @@
1
+ {"error": {"error_type": "Not Found", "error_message": "Invalid email address . [None]"}}
@@ -0,0 +1 @@
1
+ {"event": {"box_header_text_color": "005580", "link_color": "EE6600", "box_background_color": "FFFFFF", "timezone": "America/Bogota", "box_border_color": "D5D5D3", "logo": "http://eventbrite-s3.s3.amazonaws.com/eventlogos/3728086/", "organizer": {"url": "http://www.eventbrite.com/org/439974412", "description": "test", "id": 439974412, "name": "testest"}, "background_color": "FFFFFF", "id": 605286428, "category": "", "box_header_background_color": "EFEFEF", "capacity": 9001, "title": "Test", "start_date": "2010-04-20 13:00:00", "status": "Live", "description": "tada", "end_date": "2010-04-20 16:00:00", "tags": "", "text_color": "005580", "title_text_color": "", "password": "", "tickets": [{"ticket": {"description": "", "end_date": "2010-04-20 10:00:00", "visible": "true", "price": "0.00", "quantity_sold": 1, "start_date": "2010-03-29 13:47:00", "currency": "USD", "quantity_available": 100, "type": 0, "id": 8975232, "name": "Lame"}}, {"ticket": {"description": "OSB Rules", "end_date": "2010-04-20 13:00:00", "visible": "true", "quantity_sold": 0, "start_date": "2010-03-29 14:00:08", "currency": "USD", "quantity_available": 42, "type": 1, "id": 9023537, "name": "Awesomeness"}}], "created": "2010-03-10 16:44:03", "url": "http://orangesparkleball1.eventbrite.com", "box_text_color": "000000", "privacy": "Private", "venue": {"city": "Atlanta", "name": "OSB HQ", "country": "United States", "region": "GA", "longitude": -84.400000000000006, "postal_code": "30313", "address_2": "", "address": "205 Walker Street", "latitude": 33.75, "country_code": "US", "id": 377404, "Lat-Long": "33.75 / -84.4"}, "modified": "2010-03-29 15:03:50", "logo_ssl": "https://www.eventbrite.com/php/logo.php?id="}}
@@ -0,0 +1 @@
1
+ {"user": {"first_name": "David", "last_name": "Haslem", "user_id": 3728086, "date_modified": "2010-03-29 12:47:36", "user_key": "fake_key", "date_created": "2010-03-10 16:44:02", "email": "david@orangesparkleball.com"}}
@@ -0,0 +1 @@
1
+ {"events": [{"event": {"box_header_text_color": "005580", "link_color": "EE6600", "box_background_color": "FFFFFF", "timezone": "America/Bogota", "box_border_color": "D5D5D3", "logo": "http://eventbrite-s3.s3.amazonaws.com/eventlogos/3728086/", "organizer": {"url": "http://www.eventbrite.com/org/439974412", "description": "test", "id": 439974412, "name": "testest"}, "background_color": "FFFFFF", "id": 605286428, "category": "", "box_header_background_color": "EFEFEF", "capacity": 9001, "title": "Test", "start_date": "2010-04-20 13:00:00", "status": "Live", "description": "<P>bananas</P>", "end_date": "2010-04-20 16:00:00", "tags": "", "text_color": "005580", "title_text_color": "", "password": "", "tickets": [{"ticket": {"description": "", "end_date": "2010-04-20 10:00:00", "visible": "true", "price": "0.00", "quantity_sold": 1, "start_date": "2010-03-29 13:47:00", "currency": "USD", "quantity_available": 100, "type": 0, "id": 8975232, "name": "Lame"}}, {"ticket": {"description": "OSB Rules", "end_date": "2010-04-20 13:00:00", "visible": "true", "quantity_sold": 0, "start_date": "2010-03-29 14:00:08", "currency": "USD", "quantity_available": 42, "type": 1, "id": 9023537, "name": "Awesomeness"}}], "created": "2010-03-10 16:44:03", "url": "http://orangesparkleball1.eventbrite.com", "box_text_color": "000000", "privacy": "Private", "venue": {"city": "Atlanta", "name": "OSB HQ", "country": "United States", "region": "GA", "longitude": -84.400000000000006, "postal_code": "30313", "address_2": "", "address": "205 Walker Street", "latitude": 33.75, "country_code": "US", "id": 377404, "Lat-Long": "33.75 / -84.4"}, "modified": "2010-03-29 14:31:42", "logo_ssl": "https://www.eventbrite.com/php/logo.php?id="}}, {"event": {"box_header_text_color": "005580", "link_color": "EE6600", "box_background_color": "FFFFFF", "timezone": "US/Pacific", "box_border_color": "D5D5D3", "logo": "http://eventbrite-s3.s3.amazonaws.com/eventlogos/3728086/", "organizer": {"url": "http://www.eventbrite.com/org/438623018", "description": "Test 2", "id": 438623018, "name": "Orange Sparkle Ball"}, "background_color": "FFFFFF", "id": 628608184, "category": "", "box_header_background_color": "EFEFEF", "capacity": 0, "title": "", "start_date": "2010-05-04 13:00:00", "status": "Unsaved", "description": "", "end_date": "2010-05-04 16:00:00", "tags": "", "text_color": "005580", "title_text_color": "", "created": "2010-03-25 11:59:18", "url": "http://www.eventbrite.com/event/628608184", "box_text_color": "000000", "privacy": "Public", "modified": "2010-03-25 11:59:19", "logo_ssl": "https://www.eventbrite.com/php/logo.php?id="}}]}
@@ -0,0 +1 @@
1
+ {"organizers": [{"organizer": {"url": "http://www.eventbrite.com/org/438623018", "description": "Test 2", "id": 438623018, "name": "Orange Sparkle Ball"}}, {"organizer": {"url": "http://www.eventbrite.com/org/439969377", "description": "awesome", "id": 439969377, "name": "OSB Team"}}, {"organizer": {"url": "http://www.eventbrite.com/org/439974412", "description": "test", "id": 439974412, "name": "testest"}}]}
@@ -0,0 +1 @@
1
+ {"venues": [{"venue": {"city": "", "name": "", "country": "", "region": "", "longitude": 0.0, "postal_code": "", "address_2": "", "address": "", "latitude": 0.0, "country_code": "", "id": 377396}}, {"venue": {"city": "", "name": "", "country": "", "region": "", "longitude": 0.0, "postal_code": "", "address_2": "", "address": "", "latitude": 0.0, "country_code": "", "id": 377205}}, {"venue": {"city": "", "name": "", "country": "", "region": "", "longitude": 0.0, "postal_code": "", "address_2": "", "address": "", "latitude": 0.0, "country_code": "", "id": 377310}}, {"venue": {"city": "", "name": "OSB HQ", "country": "United States", "region": "GA", "longitude": 0.0, "postal_code": "", "address_2": "", "address": "", "latitude": 0.0, "country_code": "US", "id": 378509}}, {"venue": {"city": "Atlanta", "name": "OSB HQ", "country": "United States", "region": "GA", "longitude": -84.400000000000006, "postal_code": "30313", "address_2": "", "address": "205 Walker Street", "latitude": 33.75, "country_code": "US", "id": 377404}}]}
@@ -0,0 +1 @@
1
+ {"process": {"status": "OK", "message": "User_update : Nothing to Update", "id": 3754182602}}
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,35 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'rubygems'
4
+ require 'eventbright'
5
+ require 'eventbright_api_faker'
6
+ require 'spec'
7
+ require 'spec/autorun'
8
+
9
+ Spec::Runner.configure do |config|
10
+
11
+ end
12
+
13
+ module EventBright
14
+ class Banana < ApiObject; readable :val; end
15
+ class BananaBunch < ApiObjectCollection
16
+ collection_for Banana
17
+ end
18
+ class Brady < ApiObject; readable :foo, :bar; requires :foo; end
19
+ class BradyBunch < ApiObjectCollection
20
+ collection_for Brady
21
+ singlet_name "bob"
22
+ plural_name "joe"
23
+ getter :foo_bar_baz
24
+ end
25
+ class Foo < ApiObject
26
+ end
27
+ class Bar < ApiObject
28
+ singlet_name "baz"
29
+ plural_name "bazzes"
30
+ readable :foo
31
+ updatable :bar, :baz
32
+ has :banana => EventBright::Banana
33
+ collection :bananas => EventBright::BananaBunch
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eventbright
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - David Haslem
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-04-12 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 9
31
+ version: 1.2.9
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: httparty
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 5
44
+ - 2
45
+ version: 0.5.2
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description: A simple, unoffical gem that integrates with the EventBrite events service. (http://www.eventbrite.com)
49
+ email: therabidbanana@gmail.com
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files:
55
+ - LICENSE
56
+ - README.markdown
57
+ files:
58
+ - .document
59
+ - .gitignore
60
+ - LICENSE
61
+ - README.markdown
62
+ - Rakefile
63
+ - VERSION
64
+ - lib/eventbright.rb
65
+ - lib/eventbright/api_object.rb
66
+ - lib/eventbright/api_object_class_methods.rb
67
+ - lib/eventbright/api_object_collection.rb
68
+ - lib/eventbright/api_object_relationships.rb
69
+ - lib/eventbright/api_objects/attendee.rb
70
+ - lib/eventbright/api_objects/discount.rb
71
+ - lib/eventbright/api_objects/event.rb
72
+ - lib/eventbright/api_objects/organizer.rb
73
+ - lib/eventbright/api_objects/ticket.rb
74
+ - lib/eventbright/api_objects/user.rb
75
+ - lib/eventbright/api_objects/venue.rb
76
+ - lib/eventbright/error.rb
77
+ - lib/eventbright/main.rb
78
+ - spec/eventbright/api_object_class_spec.rb
79
+ - spec/eventbright/api_object_collection_spec.rb
80
+ - spec/eventbright/api_object_relationship_spec.rb
81
+ - spec/eventbright/api_object_spec.rb
82
+ - spec/eventbright/user_spec.rb
83
+ - spec/eventbright_api_faker.rb
84
+ - spec/eventbright_spec.rb
85
+ - spec/faked_responses/auth_required.json
86
+ - spec/faked_responses/event_get.json
87
+ - spec/faked_responses/user_get.json
88
+ - spec/faked_responses/user_list_events.json
89
+ - spec/faked_responses/user_list_organizers.json
90
+ - spec/faked_responses/user_list_venues.json
91
+ - spec/faked_responses/user_update.json
92
+ - spec/spec.opts
93
+ - spec/spec_helper.rb
94
+ has_rdoc: true
95
+ homepage: http://github.com/therabidbanana/eventbright
96
+ licenses: []
97
+
98
+ post_install_message:
99
+ rdoc_options:
100
+ - --charset=UTF-8
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ segments:
108
+ - 0
109
+ version: "0"
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ requirements: []
118
+
119
+ rubyforge_project:
120
+ rubygems_version: 1.3.6
121
+ signing_key:
122
+ specification_version: 3
123
+ summary: An unofficial gem for EventBrite Integration
124
+ test_files:
125
+ - spec/eventbright/api_object_class_spec.rb
126
+ - spec/eventbright/api_object_collection_spec.rb
127
+ - spec/eventbright/api_object_relationship_spec.rb
128
+ - spec/eventbright/api_object_spec.rb
129
+ - spec/eventbright/user_spec.rb
130
+ - spec/eventbright_api_faker.rb
131
+ - spec/eventbright_spec.rb
132
+ - spec/spec_helper.rb