eventbrite-api 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +12 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +86 -0
- data/LICENSE +22 -0
- data/README.md +2 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/eventbrite-api.gemspec +86 -0
- data/lib/eventbrite-api.rb +15 -0
- data/lib/eventbrite/api/client.rb +59 -0
- data/lib/eventbrite/api/helper.rb +27 -0
- data/lib/eventbrite/api/model/base.rb +85 -0
- data/lib/eventbrite/api/model/event.rb +23 -0
- data/lib/eventbrite/api/model/event_ticket_class.rb +11 -0
- data/lib/eventbrite/api/model/order.rb +11 -0
- data/lib/eventbrite/api/model/organizer.rb +11 -0
- data/lib/eventbrite/api/model/owned_event.rb +11 -0
- data/lib/eventbrite/api/model/owned_event_attendee.rb +11 -0
- data/lib/eventbrite/api/model/owned_event_order.rb +11 -0
- data/lib/eventbrite/api/model/user.rb +11 -0
- data/lib/eventbrite/api/model/user_order.rb +11 -0
- data/lib/eventbrite/api/model/user_organizer.rb +11 -0
- data/lib/eventbrite/api/model/user_venue.rb +11 -0
- data/lib/eventbrite/api/model/venue.rb +11 -0
- data/spec/eventbrite/api/client_spec.rb +46 -0
- data/spec/eventbrite/api/model/base_spec.rb +11 -0
- data/spec/eventbrite/api/model/event_spec.rb +50 -0
- data/spec/eventbrite/api/model/owned_event_attendee_spec.rb +19 -0
- data/spec/eventbrite/api/model/owned_event_order_spec.rb +19 -0
- data/spec/eventbrite/api/model/owned_event_spec.rb +19 -0
- data/spec/fixtures/events/13270934723/publish.json +129 -0
- data/spec/fixtures/events/13270934723/unpublish.json +129 -0
- data/spec/fixtures/events_page1.json +2405 -0
- data/spec/fixtures/events_page2.json +2096 -0
- data/spec/fixtures/events_page3.json +1996 -0
- data/spec/fixtures/users/133925426255/owned_event_attendees.json +11 -0
- data/spec/fixtures/users/133925426255/owned_event_orders.json +327 -0
- data/spec/fixtures/users/133925426255/owned_events.json +181 -0
- data/spec/fixtures/users/me.json +13 -0
- data/spec/spec_helper.rb +98 -0
- metadata +116 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
module Eventbrite
|
2
|
+
module Api
|
3
|
+
module Model
|
4
|
+
class Event < Base
|
5
|
+
def model_route
|
6
|
+
'events'
|
7
|
+
end
|
8
|
+
|
9
|
+
def search(opts={})
|
10
|
+
self.get(opts, 'search')
|
11
|
+
end
|
12
|
+
|
13
|
+
def publish(id)
|
14
|
+
self.update("#{id}/publish", {}, {})
|
15
|
+
end
|
16
|
+
|
17
|
+
def unpublish(id)
|
18
|
+
self.update("#{id}/unpublish", {}, {})
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eventbrite::Api::Client do
|
4
|
+
|
5
|
+
let(:consumer) { {key: 'key', secret: 'secret'} }
|
6
|
+
let(:params) { {redirect_uri: 'redirect_uri', consumer: consumer, access_token: 'access_token'} }
|
7
|
+
|
8
|
+
subject { Eventbrite::Api::Client.new(params) }
|
9
|
+
|
10
|
+
describe ".get_access_code_url" do
|
11
|
+
it "generates the access code url" do
|
12
|
+
expect(subject.get_access_code_url).to eql('https://www.eventbrite.com/oauth/authorize?client_id=key&redirect_uri=redirect_uri&response_type=code')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe ".get_access_token" do
|
17
|
+
let(:access_code) { '123' }
|
18
|
+
|
19
|
+
before { Timecop.freeze(Time.parse("2015-01-01T00:00:00")) }
|
20
|
+
after { Timecop.return }
|
21
|
+
|
22
|
+
it "requests the access_token" do
|
23
|
+
stub_request(:post, "https://www.eventbrite.com/oauth/token").
|
24
|
+
to_return(:status => 200, :body => {'access_token'=>'access_code','token_type'=>'bearer'}.to_json,
|
25
|
+
:headers => {"content-type"=>"application/json; charset=utf-8"})
|
26
|
+
|
27
|
+
subject.get_access_token(access_code)
|
28
|
+
expect(subject.access_token).to eql('access_code')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe ".connection" do
|
33
|
+
let (:expires_in) { 1200 }
|
34
|
+
|
35
|
+
before { stub_request(:post, "https://www.eventbrite.com/oauth/token").
|
36
|
+
to_return(:status => 200, :body => {'access_token'=>'access_code','token_type'=>'bearer'}.to_json,
|
37
|
+
:headers => {"content-type"=>"application/json; charset=utf-8"}) }
|
38
|
+
before { subject.get_access_token('access_code') }
|
39
|
+
|
40
|
+
context "current token is valid" do
|
41
|
+
it "returns the current access token" do
|
42
|
+
expect(subject.connection).to be_a(OAuth2::AccessToken)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eventbrite::Api::Model::Base do
|
4
|
+
|
5
|
+
let(:consumer) { {key: 'key', secret: 'secret'} }
|
6
|
+
let(:params) { {redirect_uri: 'redirect_uri', consumer: consumer, access_token: 'access_token'} }
|
7
|
+
let(:client) { Eventbrite::Api::Client.new(params) }
|
8
|
+
|
9
|
+
subject { Eventbrite::Api::Model::Base.new(client, 'base') }
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eventbrite::Api::Model::Event do
|
4
|
+
|
5
|
+
let(:consumer) { {key: 'key', secret: 'secret'} }
|
6
|
+
let(:params) { {consumer: consumer, access_token: 'access_token'} }
|
7
|
+
|
8
|
+
subject { Eventbrite::Api::Client.new(params) }
|
9
|
+
|
10
|
+
describe ".event.search" do
|
11
|
+
let(:events_page1_response) { File.read('spec/fixtures/events_page1.json') }
|
12
|
+
let(:events_page2_response) { File.read('spec/fixtures/events_page1.json') }
|
13
|
+
let(:events_page3_response) { File.read('spec/fixtures/events_page1.json') }
|
14
|
+
|
15
|
+
before { stub_request(:get, "https://www.eventbriteapi.com/v3/events/search").to_return(:status => 200, :body => events_page1_response, :headers => {}) }
|
16
|
+
before { stub_request(:get, "https://www.eventbriteapi.com/v3/events/search?page=2").to_return(:status => 200, :body => events_page2_response, :headers => {}) }
|
17
|
+
before { stub_request(:get, "https://www.eventbriteapi.com/v3/events/search?page=3").to_return(:status => 200, :body => events_page3_response, :headers => {}) }
|
18
|
+
|
19
|
+
it "fetches the list of events" do
|
20
|
+
expect(subject.event.search).to eql(JSON.parse(events_page1_response))
|
21
|
+
expect(subject.event.next_page).to eql(JSON.parse(events_page2_response))
|
22
|
+
expect(subject.event.next_page).to eql(JSON.parse(events_page3_response))
|
23
|
+
expect(subject.event.previous_page).to eql(JSON.parse(events_page2_response))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe ".event.publish" do
|
28
|
+
let(:event_response) { File.read('spec/fixtures/events/13270934723/publish.json') }
|
29
|
+
before { stub_request(:post, "https://www.eventbriteapi.com/v3/events/13270934723/publish").to_return(:status => 200, :body => event_response, :headers => {}) }
|
30
|
+
|
31
|
+
let(:response) { subject.event.publish('13270934723') }
|
32
|
+
|
33
|
+
it "publishes the event" do
|
34
|
+
expect(response.status).to eql(200)
|
35
|
+
expect(response.body).to eql(event_response)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe ".event.unpublish" do
|
40
|
+
let(:event_response) { File.read('spec/fixtures/events/13270934723/unpublish.json') }
|
41
|
+
before { stub_request(:post, "https://www.eventbriteapi.com/v3/events/13270934723/unpublish").to_return(:status => 200, :body => event_response, :headers => {}) }
|
42
|
+
|
43
|
+
let(:response) { subject.event.unpublish('13270934723') }
|
44
|
+
|
45
|
+
it "publishes the event" do
|
46
|
+
expect(response.status).to eql(200)
|
47
|
+
expect(response.body).to eql(event_response)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eventbrite::Api::Model::OwnedEventAttendee do
|
4
|
+
|
5
|
+
let(:consumer) { {key: 'key', secret: 'secret'} }
|
6
|
+
let(:params) { {consumer: consumer, access_token: 'access_token'} }
|
7
|
+
|
8
|
+
subject { Eventbrite::Api::Client.new(params) }
|
9
|
+
|
10
|
+
describe ".owned_event_attendees.get" do
|
11
|
+
let(:owned_event_attendees_response) { File.read('spec/fixtures/users/133925426255/owned_event_attendees.json') }
|
12
|
+
|
13
|
+
before { stub_request(:get, "https://www.eventbriteapi.com/v3/users/133925426255/owned_event_attendees").to_return(:status => 200, :body => owned_event_attendees_response, :headers => {}) }
|
14
|
+
|
15
|
+
it "fetches the list of owned event attendees" do
|
16
|
+
expect(subject.owned_event_attendee.get({'user_id'=>'133925426255'})).to eql(JSON.parse(owned_event_attendees_response))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eventbrite::Api::Model::OwnedEventOrder do
|
4
|
+
|
5
|
+
let(:consumer) { {key: 'key', secret: 'secret'} }
|
6
|
+
let(:params) { {consumer: consumer, access_token: 'access_token'} }
|
7
|
+
|
8
|
+
subject { Eventbrite::Api::Client.new(params) }
|
9
|
+
|
10
|
+
describe ".owned_event_order.get" do
|
11
|
+
let(:owned_event_orders_response) { File.read('spec/fixtures/users/133925426255/owned_event_orders.json') }
|
12
|
+
|
13
|
+
before { stub_request(:get, "https://www.eventbriteapi.com/v3/users/133925426255/owned_event_orders").to_return(:status => 200, :body => owned_event_orders_response, :headers => {}) }
|
14
|
+
|
15
|
+
it "fetches the list of owned event orders" do
|
16
|
+
expect(subject.owned_event_order.get({'user_id'=>'133925426255'})).to eql(JSON.parse(owned_event_orders_response))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eventbrite::Api::Model::OwnedEvent do
|
4
|
+
|
5
|
+
let(:consumer) { {key: 'key', secret: 'secret'} }
|
6
|
+
let(:params) { {consumer: consumer, access_token: 'access_token'} }
|
7
|
+
|
8
|
+
subject { Eventbrite::Api::Client.new(params) }
|
9
|
+
|
10
|
+
describe ".owned_event.get" do
|
11
|
+
let(:owned_events_response) { File.read('spec/fixtures/users/133925426255/owned_events.json') }
|
12
|
+
|
13
|
+
before { stub_request(:get, "https://www.eventbriteapi.com/v3/users/133925426255/owned_events").to_return(:status => 200, :body => owned_events_response, :headers => {}) }
|
14
|
+
|
15
|
+
it "fetches the list of owned events" do
|
16
|
+
expect(subject.owned_event.get({'user_id'=>'133925426255'})).to eql(JSON.parse(owned_events_response))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
{
|
2
|
+
"resource_uri": "https://www.eventbriteapi.com/v3/events/13270934723/",
|
3
|
+
"name": {
|
4
|
+
"text": "2015 Northwest Flower & Garden Show",
|
5
|
+
"html": "2015 Northwest Flower & Garden Show"
|
6
|
+
},
|
7
|
+
"description": {
|
8
|
+
"text": "The Northwest Flower & Garden Show is not just a bunch of pretty flowers. It’s the best annual event for gardeners to gather ideas and inspiration to help them create gracious outdoor living spaces just right for the entire family. \nOn six acres of dazzling beauty, our Display Gardens are the heart and soul of the show, featuring fully landscaped gardens showcasing the most up-to-date design trends from the region’s top designers. Whether you garden on an acre or a small balcony, you’ll take home hundreds of ideas from the show that will perfectly fit your garden. \nOur Marketplace is a shopping destination, with 350 exhibitors offering practical garden gear and unique nature-inspired art, plus loads of cool plants ready for your garden. These mini-stores have been hand-picked to represent the very best in gardening products. \nThe show is known for its outstanding educational programs – over 100 in all, all free – featuring gardening luminaries from around the US, sharing the latest trends and information with both stunning visuals and practical DIY tops. \nChildren and parents both enjoy the fun activities and interactive learning of the PlayGarden, along with lively musical entertainment to get kids singing and dancing. There’s even a Treasure Hunt! \nAs the 2nd largest garden show in the U.S., the Northwest Flower & Garden Show receives countless accolades from both seasoned gardeners and those just starting to dig in the dirt. It's a true gardener's garden show. Join us as we celebrate our 27th anniversary with “Romance Blossoms.”",
|
9
|
+
"html": "<P>The <STRONG>Northwest Flower & Garden Show</STRONG> is not just a bunch of pretty flowers. It’s the best annual event for gardeners to gather ideas and inspiration to help them create gracious outdoor living spaces just right for the entire family. </P>\r\n<P>On six acres of dazzling beauty, our Display Gardens are the heart and soul of the show, featuring fully landscaped gardens showcasing the most up-to-date design trends from the region’s top designers. Whether you garden on an acre or a small balcony, you’ll take home hundreds of ideas from the show that will perfectly fit your garden.</P>\r\n<P>Our Marketplace is a shopping destination, with 350 exhibitors offering practical garden gear and unique nature-inspired art, plus loads of cool plants ready for your garden. These mini-stores have been hand-picked to represent the very best in gardening products.</P>\r\n<P>The show is known for its outstanding educational programs – over 100 in all, all free – featuring gardening luminaries from around the US, sharing the latest trends and information with both stunning visuals and practical DIY tops.</P>\r\n<P>Children and parents both enjoy the fun activities and interactive learning of the PlayGarden, along with lively musical entertainment to get kids singing and dancing. There’s even a Treasure Hunt!</P>\r\n<P>As the 2nd largest garden show in the U.S., the Northwest Flower & Garden Show receives countless accolades from both seasoned gardeners and those just starting to dig in the dirt. It's a true gardener's garden show. Join us as we celebrate our 27th anniversary with <STRONG>“Romance Blossoms.”</STRONG></P>"
|
10
|
+
},
|
11
|
+
"logo": {
|
12
|
+
"id": "8293151",
|
13
|
+
"url": "http://cdn.evbuc.com/images/8293151/17013241839/1/logo.jpg"
|
14
|
+
},
|
15
|
+
"id": "13270934723",
|
16
|
+
"url": "http://www.eventbrite.com/e/2015-northwest-flower-garden-show-tickets-13270934723?aff=ebapi",
|
17
|
+
"logo_url": "http://cdn.evbuc.com/images/8293151/17013241839/1/logo.jpg",
|
18
|
+
"start": {
|
19
|
+
"timezone": "America/Los_Angeles",
|
20
|
+
"local": "2015-02-11T09:00:00",
|
21
|
+
"utc": "2015-02-11T17:00:00Z"
|
22
|
+
},
|
23
|
+
"end": {
|
24
|
+
"timezone": "America/Los_Angeles",
|
25
|
+
"local": "2015-02-15T18:00:00",
|
26
|
+
"utc": "2015-02-16T02:00:00Z"
|
27
|
+
},
|
28
|
+
"created": "2014-09-22T21:41:16Z",
|
29
|
+
"changed": "2015-02-20T11:24:08Z",
|
30
|
+
"capacity": null,
|
31
|
+
"status": "live",
|
32
|
+
"currency": null,
|
33
|
+
"online_event": null,
|
34
|
+
"organizer_id": "2851933763",
|
35
|
+
"venue_id": "2559073",
|
36
|
+
"category_id": "199",
|
37
|
+
"subcategory_id": null,
|
38
|
+
"format_id": "3",
|
39
|
+
"organizer": {
|
40
|
+
"description": null,
|
41
|
+
"logo": null,
|
42
|
+
"resource_uri": "https://www.eventbriteapi.com/v3/organizers/2851933763/",
|
43
|
+
"id": "2851933763",
|
44
|
+
"name": "Northwest Flower & Garden Show",
|
45
|
+
"url": "http://www.eventbrite.com/o/northwest-flower-amp-garden-show-2851933763",
|
46
|
+
"num_past_events": 4,
|
47
|
+
"num_future_events": 0
|
48
|
+
},
|
49
|
+
"venue": {
|
50
|
+
"address": {
|
51
|
+
"address_1": "800 Convention Place",
|
52
|
+
"address_2": null,
|
53
|
+
"city": "Seattle",
|
54
|
+
"region": "WA",
|
55
|
+
"postal_code": "98101",
|
56
|
+
"country": "US",
|
57
|
+
"latitude": "47.611389",
|
58
|
+
"longitude": "-122.33168"
|
59
|
+
},
|
60
|
+
"resource_uri": "https://www.eventbriteapi.com/v3/venues/2559073/",
|
61
|
+
"id": "2559073",
|
62
|
+
"name": "Washington State Convention Center",
|
63
|
+
"latitude": "47.611389",
|
64
|
+
"longitude": "-122.33168"
|
65
|
+
},
|
66
|
+
"category": {
|
67
|
+
"resource_uri": "https://www.eventbriteapi.com/v3/categories/199/",
|
68
|
+
"id": "199",
|
69
|
+
"name": "Other",
|
70
|
+
"name_localized": "Other",
|
71
|
+
"short_name": "Other",
|
72
|
+
"short_name_localized": "Other"
|
73
|
+
},
|
74
|
+
"subcategory": null,
|
75
|
+
"format": {
|
76
|
+
"resource_uri": "https://www.eventbriteapi.com/v3/formats/3/",
|
77
|
+
"id": "3",
|
78
|
+
"name": "Tradeshow, Consumer Show, or Expo",
|
79
|
+
"name_localized": "Tradeshow, Consumer Show, or Expo",
|
80
|
+
"short_name": "Expo",
|
81
|
+
"short_name_localized": "Expo"
|
82
|
+
},
|
83
|
+
"ticket_classes": [
|
84
|
+
{
|
85
|
+
"resource_uri": "https://www.eventbriteapi.com/v3/events/13270934723/ticket_classes/29007729/",
|
86
|
+
"id": "29007729",
|
87
|
+
"name": "Group",
|
88
|
+
"description": "**GROUP TICKETS ARE NOT DATE SPECIFIC. VALID ANY ONE DAY OF THE EVENT.** Valid for one adult any one day of the show. This ticket type can only be purchased online, or at the Convention Center during the days of the event. Only available for groups of 20 or more. All ticket sales are final. No refunds or exchanges will be given due to weather, parking issues, illness or travel changes.",
|
89
|
+
"cost": {
|
90
|
+
"currency": "USD",
|
91
|
+
"display": "$15.00",
|
92
|
+
"value": 1500
|
93
|
+
},
|
94
|
+
"fee": {
|
95
|
+
"currency": "USD",
|
96
|
+
"display": "$0.99",
|
97
|
+
"value": 99
|
98
|
+
},
|
99
|
+
"donation": false,
|
100
|
+
"free": false,
|
101
|
+
"minimum_quantity": 20,
|
102
|
+
"maximum_quantity": 200,
|
103
|
+
"variants": [],
|
104
|
+
"event_id": "13270934723"
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"resource_uri": "https://www.eventbriteapi.com/v3/events/13270934723/ticket_classes/29007727/",
|
108
|
+
"id": "29007727",
|
109
|
+
"name": "Youth",
|
110
|
+
"description": "**YOUTH TICKETS ARE NOT DATE SPECIFIC. VALID ANY ONE DAY OF THE EVENT.** Valid for youth ages 13 - 17 years. Children 12 and under are admitted into the show for free. Valid for one youth any one day of the show. This ticket can be purchased either online, at a local retailer (locations will be posted in December 2014) or at the Convention Center any day of the event. All ticket sales are final. No refunds or exchanges will be given due to weather, parking issues, illness or travel changes.",
|
111
|
+
"cost": {
|
112
|
+
"currency": "USD",
|
113
|
+
"display": "$5.00",
|
114
|
+
"value": 500
|
115
|
+
},
|
116
|
+
"fee": {
|
117
|
+
"currency": "USD",
|
118
|
+
"display": "$0.99",
|
119
|
+
"value": 99
|
120
|
+
},
|
121
|
+
"donation": false,
|
122
|
+
"free": false,
|
123
|
+
"minimum_quantity": 1,
|
124
|
+
"maximum_quantity": 100,
|
125
|
+
"variants": [],
|
126
|
+
"event_id": "13270934723"
|
127
|
+
}
|
128
|
+
]
|
129
|
+
}
|