Module: EventBright

Defined in:
lib/eventbright/main.rb,
lib/eventbright/error.rb,
lib/eventbright/api_object.rb,
lib/eventbright/api_objects/user.rb,
lib/eventbright/api_objects/event.rb,
lib/eventbright/api_objects/venue.rb,
lib/eventbright/api_objects/ticket.rb,
lib/eventbright/api_objects/attendee.rb,
lib/eventbright/api_objects/discount.rb,
lib/eventbright/api_object_collection.rb,
lib/eventbright/api_objects/organizer.rb,
lib/eventbright/api_object_class_methods.rb,
lib/eventbright/api_object_relationships.rb

Defined Under Namespace

Modules: ApiObjectClassMethods, ApiObjectRelationships Classes: API, ApiObject, ApiObjectCollection, Attendee, AttendeeCollection, Discount, DiscountCollection, Error, Event, EventCollection, Organizer, OrganizerCollection, OrganizerEventCollection, Ticket, TicketCollection, User, Venue, VenueCollection

Constant Summary collapse

EVENTBRITE_TIME_STRING =
'%Y-%m-%d %H:%M:%S'

Class Method Summary collapse

Class Method Details

.call(function, opts = {}) ⇒ Object


14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eventbright/main.rb', line 14

def self.call(function, opts = {})
  @app_key ||= "YmRmMmMxMjYzNDYy"
  opts[:app_key] = @app_key
  if opts[:user].is_a? EventBright::User 
    # Allow passing User object instead of user auth info.
    u = opts.delete :user
    opts.merge!(u.auth)
  end 
  debug "\tSending  /#{function}\t\t(#{opts.inspect})"
  response = API.do_post("/#{function}", :body => opts)
  debug "\tResponse /#{function}\t\t#{response.inspect}"
  response
end

.debug(msg) ⇒ Object


29
30
31
# File 'lib/eventbright/main.rb', line 29

def self.debug(msg)
  puts msg if debug?
end

.debug!Object


10
11
12
# File 'lib/eventbright/main.rb', line 10

def self.debug!
  @debug = true
end

.debug?Boolean

Returns:

  • (Boolean)

33
34
35
# File 'lib/eventbright/main.rb', line 33

def self.debug?
  @debug.nil? ? false : @debug
end

.formatted_time(date) ⇒ Object


37
38
39
40
41
42
43
44
# File 'lib/eventbright/main.rb', line 37

def self.formatted_time(date)
  case date
  when Time
    date.strftime(EVENTBRITE_TIME_STRING)
  when String
    Time.parse(String).strftime(EVENTBRITE_TIME_STRING)
  end
end

.setup(app_key = "YmRmMmMxMjYzNDYy", debug = false) ⇒ Object


5
6
7
8
# File 'lib/eventbright/main.rb', line 5

def self.setup(app_key = "YmRmMmMxMjYzNDYy", debug = false)
  @app_key = app_key
  @debug = debug
end