brownpapertickets 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ module BrownPaperTickets
2
+ class Xmlparse < HTTParty::Parser
3
+
4
+ def initialize(body, format)
5
+ @body = body
6
+ @format = format
7
+ end
8
+
9
+ def parse
10
+ perform_parsing
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,135 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Brownpapertickets" do
4
+ before(:each) do
5
+ @invalid_attributes1 = {
6
+ :id => "citizen_client",
7
+ :account => nil
8
+ }
9
+ @invalid_attributes2 = {
10
+ :id => nil,
11
+ :account => "XsIhXp7K8CknZsC"
12
+ }
13
+ @invalid_attributes3 = {
14
+ :id => nil,
15
+ :account => nil
16
+ }
17
+ @valid_attributes = {
18
+ :account => "citizen_client",
19
+ :id => "XsIhXp7K8CknZsC"
20
+ }
21
+ @resp = mock("resp")
22
+ @resp2 = mock("resp2")
23
+ @resp3 = mock("resp3")
24
+ @resp.stub!(:options).and_return({})
25
+ @resp.stub!(:perform).and_return(@resp2)
26
+ @resp2.stub!(:response).and_return(@resp3)
27
+ @bpt = BrownPaperTickets::Base.new(@valid_attributes[:id],@valid_attributes[:account])
28
+ end
29
+
30
+ it "should Raise an exception when creating a new instance of brownpapertickets with invalid arguments" do
31
+ lambda { BrownPaperTickets::Base.new(@invalid_attributes1[:id],@invalid_attributes1[:account]) }.should raise_error(ArgumentError)
32
+ end
33
+
34
+ it "should Raise an exception when creating a new instance of brownpapertickets with invalid arguments" do
35
+ lambda { BrownPaperTickets::Base.new(@invalid_attributes2[:id],@invalid_attributes2[:account]) }.should raise_error(ArgumentError)
36
+ end
37
+
38
+ it "should Raise an exception when creating a new instance of brownpapertickets with invalid arguments" do
39
+ lambda { BrownPaperTickets::Base.new(@invalid_attributes3[:id],@invalid_attributes3[:account]) }.should raise_error(ArgumentError)
40
+ end
41
+
42
+ it "should get a list of all events" do
43
+ stub_get('https://www.brownpapertickets.com/api2/eventlist?id=XsIhXp7K8CknZsC&account=citizen_client', 'all_events.xml')
44
+ @bpt.events.stub!(:all).and_return(fetch_all_events(HTTParty::Parser.call(fixture_file('all_events.xml'),:xml)["document"]["event"]))
45
+ bpt = @bpt.events.all
46
+ bpt.size.should == 5
47
+ bpt.first.event_id.should == '106861'
48
+ bpt.first.title.gsub("\n","").should == 'Nichole Canuso Dance Company Second Annual Benefit Cabaret'
49
+ bpt.last.event_id.should == '1068612'
50
+ bpt.last.title.gsub("\n","").should == 'Nichole Canuso Dance Company Second Annual Benefit Cabaret2'
51
+ end
52
+
53
+ it "should get a single event" do
54
+ stub_get('https://www.brownpapertickets.com/api2/eventlist?id=XsIhXp7K8CknZsC&account=citizen_client&event_id=106861', 'event.xml')
55
+ @bpt.events.stub!(:find).with(106861).and_return(BrownPaperTickets::Event.new(@id,@account,HTTParty::Parser.call(fixture_file('event.xml'),:xml)["document"]["event"]))
56
+ bpt = @bpt.events.find(106861)
57
+ bpt.event_id.should == '106861'
58
+ bpt.title.gsub("\n","").should == 'Nichole Canuso Dance Company Second Annual Benefit Cabaret'
59
+ end
60
+
61
+ it "should raise a exception that is missing an attr" do
62
+ event = @bpt.events.new
63
+ event.save!.should == false
64
+ event.server_response.blank?.should == false
65
+ end
66
+
67
+ it "should raise a exception that is missing an attr" do
68
+ @bpt.events.create({}).should == false
69
+ end
70
+
71
+ it "Should save the event" do
72
+ @resp3.stub!(:body).and_return(fixture_file('create_ok.xml'))
73
+ BrownPaperTickets::Httpost.stub!(:new).and_return(@resp)
74
+ event = @bpt.events.new("e_zip" => "90210", "e_name"=>"test", "e_city"=> "Sprinfield", "e_state"=>"CA", "e_short_description"=>"this is a test", "e_description"=>"this is a test")
75
+ event.save!
76
+ event.event_id.should == "120266"
77
+ end
78
+
79
+ it "Should not save the event and rise a ArgumentError" do
80
+ @resp3.stub!(:body).and_return(fixture_file('create_not_ok.xml'))
81
+ BrownPaperTickets::Httpost.stub!(:new).and_return(@resp)
82
+ event = @bpt.events.new("e_zip" => "90210", "e_name"=>"test", "e_city"=> "Sprinfield", "e_state"=>"CA", "e_short_description"=>"this is a test", "e_description"=>"this is a test")
83
+ event.save!.should == false
84
+ end
85
+
86
+ it "Should update the event with one attr" do
87
+ @resp3.stub!(:body).and_return(fixture_file('update_ok.xml'))
88
+ BrownPaperTickets::Httpost.stub!(:new).and_return(@resp)
89
+ event = @bpt.events.new("e_zip" => "90210", "e_name"=>"test", "e_city"=> "Sprinfield", "e_state"=>"CA", "e_short_description"=>"this is a test", "e_description"=>"this is a test")
90
+ event.update_attribute(:e_name, "This Awsome Title").should == true
91
+ event.server_response.should == "success"
92
+ end
93
+
94
+ it "Should not update the event with one attr" do
95
+ @resp3.stub!(:body).and_return(fixture_file('update_not_ok.xml'))
96
+ BrownPaperTickets::Httpost.stub!(:new).and_return(@resp)
97
+ event = @bpt.events.new("e_zip" => "90210", "e_name"=>"test", "e_city"=> "Sprinfield", "e_state"=>"CA", "e_short_description"=>"this is a test", "e_description"=>"this is a test")
98
+ event.update_attribute(:e_name, "This Awsome Title").should == false
99
+ event.server_response.should == "Event does not belong to account"
100
+ end
101
+
102
+ it "Should update the event with few attr" do
103
+ @resp3.stub!(:body).and_return(fixture_file('update_ok.xml'))
104
+ BrownPaperTickets::Httpost.stub!(:new).and_return(@resp)
105
+ event = @bpt.events.new("e_zip" => "90210", "e_name"=>"test", "e_city"=> "Sprinfield", "e_state"=>"CA", "e_short_description"=>"this is a test", "e_description"=>"this is a test")
106
+ event.update_attributes({:e_name => "This Awsome Title2",:e_address1 => "Evergreen av 123", :e_phone => "5553335588"}).should == true
107
+ event.server_response.should == "success"
108
+ end
109
+
110
+ it "Should not update the event with few attr" do
111
+ @resp3.stub!(:body).and_return(fixture_file('update_not_ok.xml'))
112
+ BrownPaperTickets::Httpost.stub!(:new).and_return(@resp)
113
+ event = @bpt.events.new("e_zip" => "90210", "e_name"=>"test", "e_city"=> "Sprinfield", "e_state"=>"CA", "e_short_description"=>"this is a test", "e_description"=>"this is a test")
114
+ event.update_attributes({:e_name => "This Awsome Title2",:e_address1 => "Evergreen av 123", :e_phone => "5553335588"}).should == false
115
+ event.server_response.should == "Event does not belong to account"
116
+ end
117
+
118
+ it "Should save the event" do
119
+ @resp3.stub!(:body).and_return(fixture_file('update_ok.xml'))
120
+ BrownPaperTickets::Httpost.stub!(:new).and_return(@resp)
121
+ event = @bpt.events.new("event_id"=> "120266","e_zip" => "90210", "e_name"=>"test", "e_city"=> "Sprinfield", "e_state"=>"CA", "e_short_description"=>"this is a test", "e_description"=>"this is a test")
122
+ event.title = "hello world"
123
+ event.save!.should == true
124
+ event.event_id.should == "120266"
125
+ event.e_name.should == "hello world"
126
+ end
127
+
128
+ it "Should not save the event and rise a ArgumentError" do
129
+ @resp3.stub!(:body).and_return(fixture_file('update_not_ok.xml'))
130
+ BrownPaperTickets::Httpost.stub!(:new).and_return(@resp)
131
+ event = @bpt.events.new("e_zip" => "90210", "e_name"=>"test", "e_city"=> "Sprinfield", "e_state"=>"CA", "e_short_description"=>"this is a test", "e_description"=>"this is a test")
132
+ event.save!.should == false
133
+ end
134
+
135
+ end
@@ -0,0 +1,336 @@
1
+ <document>
2
+ <result>success</result>
3
+ <resultcode>000000</resultcode>
4
+ <note/>
5
+
6
+ <event>
7
+
8
+ <title>
9
+ Nichole Canuso Dance Company Second Annual Benefit Cabaret
10
+ </title>
11
+ <link>http://www.brownpapertickets.com/event/106861</link>
12
+
13
+ <description>
14
+ An evening featuring a VIP reception, cocktails, events, silent auction, and performances by Nichole Canuso Dance Company, Johnny Showcase, Charlotte Ford, Geoff Sobelle, The Mural and The Mint, Miss Martha Graham Cracker, Meg Foley, and more!
15
+ </description>
16
+ <event_id>106861</event_id>
17
+ <live>n</live>
18
+ <e_address1>Triumph Brewing Company</e_address1>
19
+ <e_address2>117 Chestnut St</e_address2>
20
+ <e_city>Philadelphia</e_city>
21
+ <e_state>PA</e_state>
22
+ <e_country>United States</e_country>
23
+ <e_zip>19106</e_zip>
24
+ <e_phone/>
25
+ <e_web>http://www.nicholecanusodance.org</e_web>
26
+
27
+ <e_description>
28
+ Join us Thursday, June 17th at Triumph Brewing
29
+ Company of Old City, Philadelphia for performances,
30
+ cocktails,Triumph's handcrafted beers, games,
31
+ prizes and more to benefit NCDC!
32
+
33
+ 6:30 pm: VIP pre-party with the artists
34
+ **Join us for a bounty of food, drinks and conversation.
35
+ Plus a sneak peek performance of TAKES by Nichole Canuso
36
+ and Dito Van Reigersberg.
37
+
38
+ 7:30 pm: Doors open for general admission
39
+ 8:30 pm: Main event begins
40
+ 11 pm: Late night cabaret
41
+ 12 am: Dance party hosted by Laris Kreslins
42
+
43
+ There will also be many exciting events:
44
+ *JJ Tiziou's Magic Photo Booth
45
+ *Tarot card readings
46
+ *Interactive Video Installation
47
+ *Carnival Games
48
+ *Silent Auction and Raffle
49
+
50
+ Performances include:
51
+ Nichole Canuso Dance Company
52
+ Johnny Showcase
53
+ Geoff Sobelle
54
+ The Mural and The Mint
55
+ Miss Martha Graham Cracker
56
+ Meg Foley/Moving Parts
57
+ Charlotte Ford aka "Delicious Raymond Charles II"
58
+ Team Sunshine Performance Corporation
59
+
60
+ Auction and raffle highlights include two nights at a W hotel in NYC, show tickets Dance Theatre Workshop, Arden Theatre, Live Arts Festival, and Bowerbird; acupuncture, massage, and spa treatments; liquor packages; gift certificates to some of Philly's greatest boutiques and restaurants; plus boat loads more!
61
+ </e_description>
62
+ <c_name>Cristina Vasilis</c_name>
63
+ <c_phone>2154139083</c_phone>
64
+ <c_address1/>
65
+ <c_address2/>
66
+ <c_city/>
67
+ <c_state/>
68
+ <c_country/>
69
+ <c_zip/>
70
+ <c_email>cristina@nicholecanusodance.org</c_email>
71
+ </event>
72
+ <event>
73
+
74
+ <title>
75
+ Nichole Canuso Dance Company Second Annual Benefit Cabaret
76
+ </title>
77
+ <link>http://www.brownpapertickets.com/event/106861</link>
78
+
79
+ <description>
80
+ An evening featuring a VIP reception, cocktails, events, silent auction, and performances by Nichole Canuso Dance Company, Johnny Showcase, Charlotte Ford, Geoff Sobelle, The Mural and The Mint, Miss Martha Graham Cracker, Meg Foley, and more!
81
+ </description>
82
+ <event_id>106861</event_id>
83
+ <live>n</live>
84
+ <e_address1>Triumph Brewing Company</e_address1>
85
+ <e_address2>117 Chestnut St</e_address2>
86
+ <e_city>Philadelphia</e_city>
87
+ <e_state>PA</e_state>
88
+ <e_country>United States</e_country>
89
+ <e_zip>19106</e_zip>
90
+ <e_phone/>
91
+ <e_web>http://www.nicholecanusodance.org</e_web>
92
+
93
+ <e_description>
94
+ Join us Thursday, June 17th at Triumph Brewing
95
+ Company of Old City, Philadelphia for performances,
96
+ cocktails,Triumph's handcrafted beers, games,
97
+ prizes and more to benefit NCDC!
98
+
99
+ 6:30 pm: VIP pre-party with the artists
100
+ **Join us for a bounty of food, drinks and conversation.
101
+ Plus a sneak peek performance of TAKES by Nichole Canuso
102
+ and Dito Van Reigersberg.
103
+
104
+ 7:30 pm: Doors open for general admission
105
+ 8:30 pm: Main event begins
106
+ 11 pm: Late night cabaret
107
+ 12 am: Dance party hosted by Laris Kreslins
108
+
109
+ There will also be many exciting events:
110
+ *JJ Tiziou's Magic Photo Booth
111
+ *Tarot card readings
112
+ *Interactive Video Installation
113
+ *Carnival Games
114
+ *Silent Auction and Raffle
115
+
116
+ Performances include:
117
+ Nichole Canuso Dance Company
118
+ Johnny Showcase
119
+ Geoff Sobelle
120
+ The Mural and The Mint
121
+ Miss Martha Graham Cracker
122
+ Meg Foley/Moving Parts
123
+ Charlotte Ford aka "Delicious Raymond Charles II"
124
+ Team Sunshine Performance Corporation
125
+
126
+ Auction and raffle highlights include two nights at a W hotel in NYC, show tickets Dance Theatre Workshop, Arden Theatre, Live Arts Festival, and Bowerbird; acupuncture, massage, and spa treatments; liquor packages; gift certificates to some of Philly's greatest boutiques and restaurants; plus boat loads more!
127
+ </e_description>
128
+ <c_name>Cristina Vasilis</c_name>
129
+ <c_phone>2154139083</c_phone>
130
+ <c_address1/>
131
+ <c_address2/>
132
+ <c_city/>
133
+ <c_state/>
134
+ <c_country/>
135
+ <c_zip/>
136
+ <c_email>cristina@nicholecanusodance.org</c_email>
137
+ </event>
138
+ <event>
139
+
140
+ <title>
141
+ Nichole Canuso Dance Company Second Annual Benefit Cabaret
142
+ </title>
143
+ <link>http://www.brownpapertickets.com/event/106861</link>
144
+
145
+ <description>
146
+ An evening featuring a VIP reception, cocktails, events, silent auction, and performances by Nichole Canuso Dance Company, Johnny Showcase, Charlotte Ford, Geoff Sobelle, The Mural and The Mint, Miss Martha Graham Cracker, Meg Foley, and more!
147
+ </description>
148
+ <event_id>106861</event_id>
149
+ <live>n</live>
150
+ <e_address1>Triumph Brewing Company</e_address1>
151
+ <e_address2>117 Chestnut St</e_address2>
152
+ <e_city>Philadelphia</e_city>
153
+ <e_state>PA</e_state>
154
+ <e_country>United States</e_country>
155
+ <e_zip>19106</e_zip>
156
+ <e_phone/>
157
+ <e_web>http://www.nicholecanusodance.org</e_web>
158
+
159
+ <e_description>
160
+ Join us Thursday, June 17th at Triumph Brewing
161
+ Company of Old City, Philadelphia for performances,
162
+ cocktails,Triumph's handcrafted beers, games,
163
+ prizes and more to benefit NCDC!
164
+
165
+ 6:30 pm: VIP pre-party with the artists
166
+ **Join us for a bounty of food, drinks and conversation.
167
+ Plus a sneak peek performance of TAKES by Nichole Canuso
168
+ and Dito Van Reigersberg.
169
+
170
+ 7:30 pm: Doors open for general admission
171
+ 8:30 pm: Main event begins
172
+ 11 pm: Late night cabaret
173
+ 12 am: Dance party hosted by Laris Kreslins
174
+
175
+ There will also be many exciting events:
176
+ *JJ Tiziou's Magic Photo Booth
177
+ *Tarot card readings
178
+ *Interactive Video Installation
179
+ *Carnival Games
180
+ *Silent Auction and Raffle
181
+
182
+ Performances include:
183
+ Nichole Canuso Dance Company
184
+ Johnny Showcase
185
+ Geoff Sobelle
186
+ The Mural and The Mint
187
+ Miss Martha Graham Cracker
188
+ Meg Foley/Moving Parts
189
+ Charlotte Ford aka "Delicious Raymond Charles II"
190
+ Team Sunshine Performance Corporation
191
+
192
+ Auction and raffle highlights include two nights at a W hotel in NYC, show tickets Dance Theatre Workshop, Arden Theatre, Live Arts Festival, and Bowerbird; acupuncture, massage, and spa treatments; liquor packages; gift certificates to some of Philly's greatest boutiques and restaurants; plus boat loads more!
193
+ </e_description>
194
+ <c_name>Cristina Vasilis</c_name>
195
+ <c_phone>2154139083</c_phone>
196
+ <c_address1/>
197
+ <c_address2/>
198
+ <c_city/>
199
+ <c_state/>
200
+ <c_country/>
201
+ <c_zip/>
202
+ <c_email>cristina@nicholecanusodance.org</c_email>
203
+ </event>
204
+ <event>
205
+
206
+ <title>
207
+ Nichole Canuso Dance Company Second Annual Benefit Cabaret
208
+ </title>
209
+ <link>http://www.brownpapertickets.com/event/106861</link>
210
+
211
+ <description>
212
+ An evening featuring a VIP reception, cocktails, events, silent auction, and performances by Nichole Canuso Dance Company, Johnny Showcase, Charlotte Ford, Geoff Sobelle, The Mural and The Mint, Miss Martha Graham Cracker, Meg Foley, and more!
213
+ </description>
214
+ <event_id>106861</event_id>
215
+ <live>n</live>
216
+ <e_address1>Triumph Brewing Company</e_address1>
217
+ <e_address2>117 Chestnut St</e_address2>
218
+ <e_city>Philadelphia</e_city>
219
+ <e_state>PA</e_state>
220
+ <e_country>United States</e_country>
221
+ <e_zip>19106</e_zip>
222
+ <e_phone/>
223
+ <e_web>http://www.nicholecanusodance.org</e_web>
224
+
225
+ <e_description>
226
+ Join us Thursday, June 17th at Triumph Brewing
227
+ Company of Old City, Philadelphia for performances,
228
+ cocktails,Triumph's handcrafted beers, games,
229
+ prizes and more to benefit NCDC!
230
+
231
+ 6:30 pm: VIP pre-party with the artists
232
+ **Join us for a bounty of food, drinks and conversation.
233
+ Plus a sneak peek performance of TAKES by Nichole Canuso
234
+ and Dito Van Reigersberg.
235
+
236
+ 7:30 pm: Doors open for general admission
237
+ 8:30 pm: Main event begins
238
+ 11 pm: Late night cabaret
239
+ 12 am: Dance party hosted by Laris Kreslins
240
+
241
+ There will also be many exciting events:
242
+ *JJ Tiziou's Magic Photo Booth
243
+ *Tarot card readings
244
+ *Interactive Video Installation
245
+ *Carnival Games
246
+ *Silent Auction and Raffle
247
+
248
+ Performances include:
249
+ Nichole Canuso Dance Company
250
+ Johnny Showcase
251
+ Geoff Sobelle
252
+ The Mural and The Mint
253
+ Miss Martha Graham Cracker
254
+ Meg Foley/Moving Parts
255
+ Charlotte Ford aka "Delicious Raymond Charles II"
256
+ Team Sunshine Performance Corporation
257
+
258
+ Auction and raffle highlights include two nights at a W hotel in NYC, show tickets Dance Theatre Workshop, Arden Theatre, Live Arts Festival, and Bowerbird; acupuncture, massage, and spa treatments; liquor packages; gift certificates to some of Philly's greatest boutiques and restaurants; plus boat loads more!
259
+ </e_description>
260
+ <c_name>Cristina Vasilis</c_name>
261
+ <c_phone>2154139083</c_phone>
262
+ <c_address1/>
263
+ <c_address2/>
264
+ <c_city/>
265
+ <c_state/>
266
+ <c_country/>
267
+ <c_zip/>
268
+ <c_email>cristina@nicholecanusodance.org</c_email>
269
+ </event>
270
+ <event>
271
+
272
+ <title>
273
+ Nichole Canuso Dance Company Second Annual Benefit Cabaret2
274
+ </title>
275
+ <link>http://www.brownpapertickets.com/event/1068612</link>
276
+
277
+ <description>
278
+ An evening featuring a VIP reception, cocktails, events, silent auction, and performances by Nichole Canuso Dance Company, Johnny Showcase, Charlotte Ford, Geoff Sobelle, The Mural and The Mint, Miss Martha Graham Cracker, Meg Foley, and more!
279
+ </description>
280
+ <event_id>1068612</event_id>
281
+ <live>n</live>
282
+ <e_address1>Triumph Brewing Company</e_address1>
283
+ <e_address2>117 Chestnut St</e_address2>
284
+ <e_city>Philadelphia</e_city>
285
+ <e_state>PA</e_state>
286
+ <e_country>United States</e_country>
287
+ <e_zip>19106</e_zip>
288
+ <e_phone/>
289
+ <e_web>http://www.nicholecanusodance.org</e_web>
290
+
291
+ <e_description>
292
+ Join us Thursday, June 17th at Triumph Brewing
293
+ Company of Old City, Philadelphia for performances,
294
+ cocktails,Triumph's handcrafted beers, games,
295
+ prizes and more to benefit NCDC!
296
+
297
+ 6:30 pm: VIP pre-party with the artists
298
+ **Join us for a bounty of food, drinks and conversation.
299
+ Plus a sneak peek performance of TAKES by Nichole Canuso
300
+ and Dito Van Reigersberg.
301
+
302
+ 7:30 pm: Doors open for general admission
303
+ 8:30 pm: Main event begins
304
+ 11 pm: Late night cabaret
305
+ 12 am: Dance party hosted by Laris Kreslins
306
+
307
+ There will also be many exciting events:
308
+ *JJ Tiziou's Magic Photo Booth
309
+ *Tarot card readings
310
+ *Interactive Video Installation
311
+ *Carnival Games
312
+ *Silent Auction and Raffle
313
+
314
+ Performances include:
315
+ Nichole Canuso Dance Company
316
+ Johnny Showcase
317
+ Geoff Sobelle
318
+ The Mural and The Mint
319
+ Miss Martha Graham Cracker
320
+ Meg Foley/Moving Parts
321
+ Charlotte Ford aka "Delicious Raymond Charles II"
322
+ Team Sunshine Performance Corporation
323
+
324
+ Auction and raffle highlights include two nights at a W hotel in NYC, show tickets Dance Theatre Workshop, Arden Theatre, Live Arts Festival, and Bowerbird; acupuncture, massage, and spa treatments; liquor packages; gift certificates to some of Philly's greatest boutiques and restaurants; plus boat loads more!
325
+ </e_description>
326
+ <c_name>Cristina Vasilis</c_name>
327
+ <c_phone>2154139083</c_phone>
328
+ <c_address1/>
329
+ <c_address2/>
330
+ <c_city/>
331
+ <c_state/>
332
+ <c_country/>
333
+ <c_zip/>
334
+ <c_email>cristina@nicholecanusodance.org</c_email>
335
+ </event>
336
+ </document>