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.



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

#colorObject (readonly)

Returns the value of attribute color.



604
605
606
# File 'lib/sendly/types.rb', line 604

def color
  @color
end

#created_atObject (readonly)

Returns the value of attribute created_at.



604
605
606
# File 'lib/sendly/types.rb', line 604

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



604
605
606
# File 'lib/sendly/types.rb', line 604

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



604
605
606
# File 'lib/sendly/types.rb', line 604

def id
  @id
end

#nameObject (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_hObject



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