Class: Sendly::Label
- Inherits:
-
Object
- Object
- Sendly::Label
- Defined in:
- lib/sendly/types.rb
Overview
Labels
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(data) ⇒ Label
constructor
A new instance of Label.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ Label
Returns a new instance of Label.
606 607 608 609 610 611 612 |
# File 'lib/sendly/types.rb', line 606 def initialize(data) @id = data["id"] @name = data["name"] @color = data["color"] @description = data["description"] @created_at = parse_time(data["createdAt"] || data["created_at"]) end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
604 605 606 |
# File 'lib/sendly/types.rb', line 604 def color @color end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
604 605 606 |
# File 'lib/sendly/types.rb', line 604 def created_at @created_at end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
604 605 606 |
# File 'lib/sendly/types.rb', line 604 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
604 605 606 |
# File 'lib/sendly/types.rb', line 604 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
604 605 606 |
# File 'lib/sendly/types.rb', line 604 def name @name end |
Instance Method Details
#to_h ⇒ Object
614 615 616 617 618 619 |
# File 'lib/sendly/types.rb', line 614 def to_h { id: id, name: name, color: color, description: description, created_at: created_at&.iso8601 }.compact end |