Class: Chiketto::Event
Instance Attribute Summary collapse
-
#capacity ⇒ Object
readonly
Returns the value of attribute capacity.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#logo ⇒ Object
readonly
Returns the value of attribute logo.
-
#logo_url ⇒ Object
readonly
Returns the value of attribute logo_url.
-
#resource_uri ⇒ Object
readonly
Returns the value of attribute resource_uri.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
- #attendees(params = {}) ⇒ Object
- #organizer ⇒ Object
- #ticket_classes ⇒ Object
- #update(params) ⇒ Object
- #venue ⇒ Object
Methods inherited from Resource
endpoint, get, #initialize, legacy_endpoint, open_post, post, query, 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 |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def categories @categories 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 |
#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 |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/chiketto/event.rb', line 3 def url @url end |
Class Method Details
.create(params) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/chiketto/event.rb', line 19 def self.create(params) params[:title] = params.delete(:name) if params[:name] response = Event.post 'event_new', params if response.fetch('process', false) Event.find response['process']['id'] end end |
Instance Method Details
#attendees(params = {}) ⇒ Object
37 38 39 40 |
# File 'lib/chiketto/event.rb', line 37 def attendees(params = {}) attendees = Event.find_attendees @id, params attendees['attendees'].map { |att| Attendee.new att } end |
#organizer ⇒ Object
42 43 44 |
# File 'lib/chiketto/event.rb', line 42 def organizer Organizer.new @organizer.to_h end |
#ticket_classes ⇒ Object
46 47 48 49 50 |
# File 'lib/chiketto/event.rb', line 46 def ticket_classes @ticket_classes.map do |t_class| TicketClass.new t_class.to_h end end |
#update(params) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/chiketto/event.rb', line 52 def update(params) params[:id] = @id params[:title] = params.delete(:name) if params[:name] response = Event.post 'event_update', params if response.fetch('process', false) response['process']['status'].upcase == 'OK' end end |