lib/eventbrite_sdk/event.rb in eventbrite_sdk-3.1.5 vs lib/eventbrite_sdk/event.rb in eventbrite_sdk-3.1.6

- old
+ new

@@ -1,10 +1,18 @@ module EventbriteSDK class Event < Resource ERROR_CANNOT_UNPUBLISH = 'CANNOT_UNPUBLISH'.freeze ERROR_ALREADY_PUBLISHED_OR_DELETED = 'ALREADY_PUBLISHED_OR_DELETED'.freeze + ERROR_ALREADY_CANCELED = 'ALREADY_CANCELED'.freeze + STATUS_CANCELED = 'canceled'.freeze + STATUS_COMPLETED = 'completed'.freeze + STATUS_DELETED = 'deleted'.freeze + STATUS_ENDED = 'ended'.freeze + STATUS_LIVE = 'live'.freeze + STATUS_STARTED = 'started'.freeze + # Defines event#cancel, event#publish, and event#unpublish # # When an event has an id the POST is made, otherwise we return false # POSTS to event/:id/(cancel|publish|unpublish) define_api_actions :cancel, :publish, :unpublish @@ -17,10 +25,11 @@ belongs_to :venue, object_class: 'Venue' has_many :orders, object_class: 'Order' has_many :attendees, object_class: 'Attendee' has_many :ticket_classes, object_class: 'TicketClass' + has_many :ticket_groups, object_class: 'TicketGroup' schema_definition do multipart 'name' multipart 'description' string 'organizer_id' @@ -60,9 +69,18 @@ def list! unless listed assign_attributes('listed' => true) save end + end + + def over? + [ + self.class::STATUS_CANCELED, + self.class::STATUS_COMPLETED, + self.class::STATUS_DELETED, + self.class::STATUS_ENDED + ].include?(status) end def unlist! if listed assign_attributes('listed' => false)