Class: Chiketto::Event
Instance Attribute Summary collapse
-
#capacity ⇒ Object
readonly
Returns the value of attribute capacity.
-
#category_id ⇒ Object
readonly
Returns the value of attribute category_id.
-
#logo ⇒ Object
readonly
Returns the value of attribute logo.
-
#logo_url ⇒ Object
readonly
Returns the value of attribute logo_url.
-
#organizer_id ⇒ Object
readonly
Returns the value of attribute organizer_id.
-
#resource_uri ⇒ Object
readonly
Returns the value of attribute resource_uri.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#subcategory_id ⇒ Object
readonly
Returns the value of attribute subcategory_id.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#venue_id ⇒ Object
readonly
Returns the value of attribute venue_id.
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
- #attendees(params = {}) ⇒ Object
- #category ⇒ Object
- #listed? ⇒ Boolean
- #organizer ⇒ Object
- #questions ⇒ Object
- #subcategory ⇒ Object
- #ticket_classes ⇒ Object
- #update(params) ⇒ Object
- #venue ⇒ Object
Methods inherited from Resource
build_query_string, endpoint, get, #initialize, open_post, paginated, post, should_paginate, token
Methods included from AttrDSL
Constructor Details
This class inherits a constructor from Chiketto::Resource
Instance Attribute Details
#capacity ⇒ Object (readonly)
Returns the value of attribute capacity.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def capacity @capacity end |
#category_id ⇒ Object (readonly)
Returns the value of attribute category_id.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def category_id @category_id end |
#logo ⇒ Object (readonly)
Returns the value of attribute logo.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def logo @logo end |
#logo_url ⇒ Object (readonly)
Returns the value of attribute logo_url.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def logo_url @logo_url end |
#organizer_id ⇒ Object (readonly)
Returns the value of attribute organizer_id.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def organizer_id @organizer_id end |
#resource_uri ⇒ Object (readonly)
Returns the value of attribute resource_uri.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def resource_uri @resource_uri end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def status @status end |
#subcategory_id ⇒ Object (readonly)
Returns the value of attribute subcategory_id.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def subcategory_id @subcategory_id end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def url @url end |
#venue_id ⇒ Object (readonly)
Returns the value of attribute venue_id.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def venue_id @venue_id end |
Class Method Details
.create(params) ⇒ Object
8 9 10 11 |
# File 'lib/chiketto/event.rb', line 8 def self.create(params) response = Event.post 'events', params Event.new response end |
Instance Method Details
#attendees(params = {}) ⇒ Object
23 24 25 26 |
# File 'lib/chiketto/event.rb', line 23 def attendees(params = {}) attendees = Event.paginated_attendees @id, params attendees.map { |att| Attendee.new att } end |
#category ⇒ Object
28 29 30 |
# File 'lib/chiketto/event.rb', line 28 def category @category = find_or_fetch_category(@category, @category_id) end |
#listed? ⇒ Boolean
32 33 34 |
# File 'lib/chiketto/event.rb', line 32 def listed? !!@listed end |
#organizer ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/chiketto/event.rb', line 41 def organizer if @organizer.is_a?(Organizer) @organizer elsif @organizer @organizer = Organizer.new @organizer.to_h elsif @organizer_id @organizer = Organizer.find @organizer_id end end |
#questions ⇒ Object
36 37 38 39 |
# File 'lib/chiketto/event.rb', line 36 def questions questions = Event.find_questions id questions['questions'].map { |question| Question.new question } end |
#subcategory ⇒ Object
51 52 53 |
# File 'lib/chiketto/event.rb', line 51 def subcategory @subcategory = find_or_fetch_category(@subcategory, @subcategory_id) end |
#ticket_classes ⇒ Object
55 56 57 58 59 60 |
# File 'lib/chiketto/event.rb', line 55 def ticket_classes return [] unless @ticket_classes @ticket_classes.map do |t_class| TicketClass.new t_class.to_h end end |