Class: Zvents::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/zvents/event.rb

Constant Summary collapse

RESOURCE_URL =
'/partner_rest/event'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find(id) ⇒ Object

Zvent::Event.find(‘123123’) => an instance of an event



33
34
35
36
37
38
39
40
41
42
# File 'lib/zvents/event.rb', line 33

def self.find(id)
    parameters = {id: id}
    response = Zvents.find(RESOURCE_URL, parameters)

    if response.body['rsp']['status'] != 'ok'
        raise Zvents::EventNotFoundError.new("could not find event with id #{id}")
    end
    venue_hash = {venue: response.body['rsp']['content']['venues'].first}
    self.new(response.body['rsp']['content']['events'].first.merge(venue_hash))
end

Instance Method Details

#venueObject

venue() => an instance of the venue where the event takes place



46
47
48
# File 'lib/zvents/event.rb', line 46

def venue
    @venue ||= Zvents::Venue.find(@venue_id)
end