Class: WelcuApi::Event

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEvent

Returns a new instance of Event.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/welcu_api/event.rb', line 16

def initialize
  response = WelcuApi.request(:get, WelcuApi::Event.event_url, @api_key, {})
  json_event = MultiJson.load(response)

  @id = json_event["id"].to_i
  @name = json_event["name"]

  @starts_at = Time.new json_event["starts_at"]
  @ends_at = Time.new json_event["ends_at"]
  @locale = json_event["locale"].to_sym
  @timezone = json_event["timezone"]
  @state = json_event["state"].to_sym
  @url = json_event["url"]
  @public = json_event["public"] == "true"
  @company = WelcuApi::Company.new(json_event["company"]["id"], json_event["company"]["name"])
  @location = json_event["location"]

  @tickets = []
  json_event["tickets"].each do |ticket|
    @tickets << WelcuApi::Ticket.new(ticket)
  end
end

Instance Attribute Details

#companyObject (readonly)

Returns the value of attribute company.



13
14
15
# File 'lib/welcu_api/event.rb', line 13

def company
  @company
end

#ends_atObject (readonly)

Returns the value of attribute ends_at.



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

def ends_at
  @ends_at
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/welcu_api/event.rb', line 3

def id
  @id
end

#localeObject (readonly)

Returns the value of attribute locale.



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

def locale
  @locale
end

#locationObject (readonly)

Returns the value of attribute location.



12
13
14
# File 'lib/welcu_api/event.rb', line 12

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/welcu_api/event.rb', line 4

def name
  @name
end

#publicObject (readonly)

Returns the value of attribute public.



11
12
13
# File 'lib/welcu_api/event.rb', line 11

def public
  @public
end

#starts_atObject (readonly)

Returns the value of attribute starts_at.



5
6
7
# File 'lib/welcu_api/event.rb', line 5

def starts_at
  @starts_at
end

#stateObject (readonly)

Returns the value of attribute state.



9
10
11
# File 'lib/welcu_api/event.rb', line 9

def state
  @state
end

#ticketsObject (readonly)

Returns the value of attribute tickets.



14
15
16
# File 'lib/welcu_api/event.rb', line 14

def tickets
  @tickets
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



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

def timezone
  @timezone
end

#urlObject (readonly)

Returns the value of attribute url.



10
11
12
# File 'lib/welcu_api/event.rb', line 10

def url
  @url
end