Class: SimpleEventickApi::Event

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

get, resource

Constructor Details

#initialize(args = {}) ⇒ Event

constructors



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

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.



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

def all
  @all
end

#attendeesObject (readonly)

Returns the value of attribute attendees.



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

def attendees
  @attendees
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/simple_eventick_api/event.rb', line 6

def id
  @id
end

#slugObject

Returns the value of attribute slug.



6
7
8
# File 'lib/simple_eventick_api/event.rb', line 6

def slug
  @slug
end

#start_atObject

Returns the value of attribute start_at.



6
7
8
# File 'lib/simple_eventick_api/event.rb', line 6

def start_at
  @start_at
end

#ticketsObject

Returns the value of attribute tickets.



6
7
8
# File 'lib/simple_eventick_api/event.rb', line 6

def tickets
  @tickets
end

#titleObject

Returns the value of attribute title.



6
7
8
# File 'lib/simple_eventick_api/event.rb', line 6

def title
  @title
end

#venueObject

Returns the value of attribute venue.



6
7
8
# File 'lib/simple_eventick_api/event.rb', line 6

def venue
  @venue
end

Class Method Details

.all(token) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/simple_eventick_api/event.rb', line 20

def self.all (token)
  resource "events"
  
  response = get(token)

  events = Array.new

  response['events'].map { |r| 
    e = self.new (r)
    events << e
  } 
  events
end

.find(token, event_id) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/simple_eventick_api/event.rb', line 34

def self.find (token, event_id)
  resource "events/#{event_id}"
  
  response = get(token)

  r = response['events'].first 
  self.new (r)
end