Class: Eventick::Event

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

path, resource

Constructor Details

#initialize(args = {}) ⇒ Event

constructors



11
12
13
14
15
16
17
18
# File 'lib/eventick/event.rb', line 11

def initialize(args={})
  links = args.delete('links')
  args.each do |key, value|
    self.public_send("#{key}=", value)
  end

  self.tickets = links['tickets'].map { |o| Ticket.new(o) } if links
end

Instance Attribute Details

#allObject (readonly)

Returns the value of attribute all.



8
9
10
# File 'lib/eventick/event.rb', line 8

def all
  @all
end

#attendees(reload = false) ⇒ Object (readonly)

instance methods



34
35
36
# File 'lib/eventick/event.rb', line 34

def attendees
  @attendees
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/eventick/event.rb', line 7

def id
  @id
end

#slugObject

Returns the value of attribute slug.



7
8
9
# File 'lib/eventick/event.rb', line 7

def slug
  @slug
end

#start_atObject

Returns the value of attribute start_at.



7
8
9
# File 'lib/eventick/event.rb', line 7

def start_at
  @start_at
end

#ticketsObject

Returns the value of attribute tickets.



7
8
9
# File 'lib/eventick/event.rb', line 7

def tickets
  @tickets
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/eventick/event.rb', line 7

def title
  @title
end

#venueObject

Returns the value of attribute venue.



7
8
9
# File 'lib/eventick/event.rb', line 7

def venue
  @venue
end

Class Method Details

.allObject

class methods



21
22
23
24
# File 'lib/eventick/event.rb', line 21

def self.all
  events_response = Eventick.get path
  events_response['events'].map { |event_response| self.new event_response }
end

.find_by_id(id) ⇒ Object

class methods



27
28
29
30
31
# File 'lib/eventick/event.rb', line 27

def self.find_by_id(id)
  events_response = Eventick.get path({ id: id })
  params = events_response['events'].first
  self.new params unless params.empty?
end