Class: WelcuApi::Ticket
- Inherits:
-
Object
- Object
- WelcuApi::Ticket
- Defined in:
- lib/welcu_api/ticket.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#ends_at ⇒ Object
readonly
Returns the value of attribute ends_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#starts_at ⇒ Object
readonly
Returns the value of attribute starts_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ticket_json) ⇒ Ticket
constructor
A new instance of Ticket.
Constructor Details
#initialize(ticket_json) ⇒ Ticket
Returns a new instance of Ticket.
10 11 12 13 14 15 16 17 |
# File 'lib/welcu_api/ticket.rb', line 10 def initialize(ticket_json) @id = (ticket_json["id"] || ticket_json["ticket_id"]).to_i @name = ticket_json["name"] @code = ticket_json["code"] @starts_at = Time.new(ticket_json["starts_at"]) unless ticket_json["starts_at"].nil? @ends_at = Time.new(ticket_json["ends_at"]) unless ticket_json["ends_at"].nil? @location = ticket_json["location"] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
8 9 10 |
# File 'lib/welcu_api/ticket.rb', line 8 def code @code end |
#ends_at ⇒ Object (readonly)
Returns the value of attribute ends_at.
6 7 8 |
# File 'lib/welcu_api/ticket.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/ticket.rb', line 3 def id @id end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
7 8 9 |
# File 'lib/welcu_api/ticket.rb', line 7 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/welcu_api/ticket.rb', line 4 def name @name end |
#starts_at ⇒ Object (readonly)
Returns the value of attribute starts_at.
5 6 7 |
# File 'lib/welcu_api/ticket.rb', line 5 def starts_at @starts_at end |