Class: WelcuApi::Event
- Inherits:
-
Object
- Object
- WelcuApi::Event
- Defined in:
- lib/welcu_api/event.rb
Instance Attribute Summary collapse
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#ends_at ⇒ Object
readonly
Returns the value of attribute ends_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#public ⇒ Object
readonly
Returns the value of attribute public.
-
#starts_at ⇒ Object
readonly
Returns the value of attribute starts_at.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#tickets ⇒ Object
readonly
Returns the value of attribute tickets.
-
#timezone ⇒ Object
readonly
Returns the value of attribute timezone.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize ⇒ Event
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
#company ⇒ Object (readonly)
Returns the value of attribute company.
13 14 15 |
# File 'lib/welcu_api/event.rb', line 13 def company @company end |
#ends_at ⇒ Object (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 |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/welcu_api/event.rb', line 3 def id @id end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
7 8 9 |
# File 'lib/welcu_api/event.rb', line 7 def locale @locale end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
12 13 14 |
# File 'lib/welcu_api/event.rb', line 12 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/welcu_api/event.rb', line 4 def name @name end |
#public ⇒ Object (readonly)
Returns the value of attribute public.
11 12 13 |
# File 'lib/welcu_api/event.rb', line 11 def public @public end |
#starts_at ⇒ Object (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 |
#state ⇒ Object (readonly)
Returns the value of attribute state.
9 10 11 |
# File 'lib/welcu_api/event.rb', line 9 def state @state end |
#tickets ⇒ Object (readonly)
Returns the value of attribute tickets.
14 15 16 |
# File 'lib/welcu_api/event.rb', line 14 def tickets @tickets end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
8 9 10 |
# File 'lib/welcu_api/event.rb', line 8 def timezone @timezone end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
10 11 12 |
# File 'lib/welcu_api/event.rb', line 10 def url @url end |