Class: EventbriteSDK::TicketClass

Inherits:
Resource
  • Object
show all
Defined in:
lib/eventbrite_sdk/ticket_class.rb

Constant Summary collapse

ON_SALE_STATUS_AVAILABLE =
'AVAILABLE'.freeze
NOT_YET_ON_SALE =

Ticket classes with future start dates are marked as NOT_YET_ON_SALE

'NOT_YET_ON_SALE'.freeze
AT_THE_DOOR =

Constants for the supported sales channels

'atd'.freeze
ONLINE =
'online'.freeze
SALES_CHANNELS =
[AT_THE_DOOR, ONLINE].freeze

Instance Method Summary collapse

Methods inherited from Resource

build, define_api_actions, #delete, #initialize, #inspect, #new?, #read_attribute_for_serialization, #refresh!, #save, #to_json

Methods included from Resource::Operations::Relationships

included

Methods included from Resource::Operations::Endpoint

included

Methods included from Resource::Operations::AttributeSchema

included

Constructor Details

This class inherits a constructor from EventbriteSDK::Resource

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/eventbrite_sdk/ticket_class.rb', line 41

def available?
  respond_to?(:on_sale_status) && on_sale_status == ON_SALE_STATUS_AVAILABLE
end

#available_in_the_future?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/eventbrite_sdk/ticket_class.rb', line 45

def available_in_the_future?
  respond_to?(:on_sale_status) && on_sale_status == NOT_YET_ON_SALE
end

#change(attrs) ⇒ Object



57
58
59
60
# File 'lib/eventbrite_sdk/ticket_class.rb', line 57

def change(attrs)
  assign_attributes(attrs)
  save
end

#hide!Object



49
50
51
# File 'lib/eventbrite_sdk/ticket_class.rb', line 49

def hide!
  hidden || change('hidden' => true)
end

#unhide!Object



53
54
55
# File 'lib/eventbrite_sdk/ticket_class.rb', line 53

def unhide!
  !hidden || change('hidden' => false)
end