Class: Sendly::Label

Inherits:
Object
  • Object
show all
Defined in:
lib/sendly/types.rb

Overview

============================================================================

Labels

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Label

Returns a new instance of Label.



754
755
756
757
758
759
760
# File 'lib/sendly/types.rb', line 754

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

#colorObject (readonly)

Returns the value of attribute color.



752
753
754
# File 'lib/sendly/types.rb', line 752

def color
  @color
end

#created_atObject (readonly)

Returns the value of attribute created_at.



752
753
754
# File 'lib/sendly/types.rb', line 752

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



752
753
754
# File 'lib/sendly/types.rb', line 752

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



752
753
754
# File 'lib/sendly/types.rb', line 752

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



752
753
754
# File 'lib/sendly/types.rb', line 752

def name
  @name
end

Instance Method Details

#to_hObject



762
763
764
765
766
767
# File 'lib/sendly/types.rb', line 762

def to_h
  {
    id: id, name: name, color: color, description: description,
    created_at: created_at&.iso8601
  }.compact
end