brownpapertickets 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -67,11 +67,9 @@ module BrownPaperTickets
67
67
 
68
68
  def save!
69
69
  if self.date_id.blank?
70
- #changeevent
71
70
  return false unless validates_required_attr
72
71
  new_save("adddate")
73
72
  else
74
- #createevent
75
73
  new_save("changedate")
76
74
  end
77
75
  end
@@ -84,11 +82,8 @@ module BrownPaperTickets
84
82
  st = response.perform
85
83
  xml = Hpricot(st.response.body)
86
84
  if param == "adddate"
87
- p "algo"*12
88
85
  self.date_id = (xml/:date_id).inner_html if (xml/:resultcode).inner_html == "000000"
89
86
  process_create_response( (xml/:resultcode).inner_html, date_id)
90
- p date_id
91
- p event_id
92
87
  else
93
88
  process_update_response( (xml/:resultcode).inner_html)
94
89
  end
@@ -25,6 +25,9 @@ module BrownPaperTickets
25
25
 
26
26
  def all
27
27
  events = Event.get("/eventlist", :query =>{"id" => @@id , "account" => @@account })
28
+ event_sales = Event.get("/eventsales", :query =>{"id" => @@id , "account" => @@account })
29
+ p "*"*12
30
+ p event_sales
28
31
  parsed_event = []
29
32
  events.parsed_response["document"]["event"].each do |event|
30
33
  parsed_event << Event.new(@id,@account, event)
@@ -34,6 +37,9 @@ module BrownPaperTickets
34
37
 
35
38
  def find(event_id)
36
39
  event = Event.get("/eventlist",:query =>{"id" => @@id , "account" => @@account, "event_id" => event_id })
40
+ event_sales=Event.get("/eventsales",:query =>{"id" => @@id , "account" => @@account, "event_id" => event_id })
41
+ p "*"*12
42
+ p event_sales
37
43
  @attributes = event.parsed_response["document"]["event"]
38
44
  return self
39
45
  end
@@ -83,6 +89,9 @@ module BrownPaperTickets
83
89
  body = {"id" => @@id, "account" => @@account}
84
90
  query = self.attributes.merge("id" => @@id, "account" => @@account)
85
91
  response = BrownPaperTickets::Httpost.new(Net::HTTP::Post, "https://www.brownpapertickets.com/api2/#{param}",:query => query)
92
+ response1 = BrownPaperTickets::Httpost.new(Net::HTTP::Get, "https://www.brownpapertickets.com/api2/eventsales",:query => query)
93
+ p "*"*12
94
+ p response1
86
95
  response.options[:body] = query
87
96
  st = response.perform
88
97
  xml = Hpricot(st.response.body)
@@ -90,7 +99,6 @@ module BrownPaperTickets
90
99
  if param == "createevent"
91
100
  event_id = (xml/:event_id).inner_html if (xml/:resultcode).inner_html == "000000"
92
101
  process_create_response( (xml/:resultcode).inner_html, event_id)
93
- p event_id
94
102
  else
95
103
  process_update_response( (xml/:resultcode).inner_html)
96
104
  end
@@ -61,13 +61,21 @@ module BrownPaperTickets
61
61
  end
62
62
 
63
63
  # Response while saving
64
- # 300036 - Required variables are missing
65
- # 300037 - Unknown error while posting info to DB
66
- # 000000 - Success
64
+ # 300042 - Required variables are missing
65
+ # 300043 - Unknown error while fetching event info from DB
66
+ # 300044 - Event does not belong to account
67
+ # 300045 - Unknown error while fetching date info from DB
68
+ # 300046 - Unable to find date
69
+ # 300047 - Unable to add price
70
+ # 0000 - Success.
67
71
 
68
72
  def save!
69
- new_save("addprice")
70
- p "save1"*12
73
+ if self.price_id.blank?
74
+ return false unless validates_required_attr
75
+ new_save("addprice")
76
+ else
77
+ new_save("changeprice")
78
+ end
71
79
  end
72
80
 
73
81
  def new_save(param)
@@ -79,10 +87,8 @@ module BrownPaperTickets
79
87
  xml = Hpricot(st.response.body)
80
88
 
81
89
  if param == "addprice"
82
- p "algo"*12
83
90
  self.price_id = (xml/:price_id).inner_html if (xml/:resultcode).inner_html == "000000"
84
91
  process_create_response( (xml/:resultcode).inner_html, price_id)
85
- p (xml/:resultcode).inner_html
86
92
  else
87
93
  process_update_response( (xml/:resultcode).inner_html)
88
94
  end
@@ -120,12 +126,13 @@ module BrownPaperTickets
120
126
  end
121
127
 
122
128
  # resultcode
123
- # 300049 - Required variables are missing
124
- # 300050 - Unknown error
125
- # 300051 - Unable to find event
126
- # 300052 - Event does not belong to account
127
- # 300053 - Required variables are missing
128
- # 300054 - Unable to update event
129
+ # 300063 - Required variables are missing
130
+ # 300064 - Unable to find event
131
+ # 300065 - Event does not belong to account
132
+ # 300066 - Unknown error
133
+ # 300067 - No such price for this event
134
+ # 300068 - Required variables are missing
135
+ # 300069 - Unable to change price
129
136
  # 000000 - Success
130
137
 
131
138
  def update_attribute(key, value)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brownpapertickets
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alvaro Insignares
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-22 00:00:00 -05:00
19
+ date: 2011-02-23 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency