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.



675
676
677
678
679
680
681
# File 'lib/sendly/types.rb', line 675

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.



673
674
675
# File 'lib/sendly/types.rb', line 673

def color
  @color
end

#created_atObject (readonly)

Returns the value of attribute created_at.



673
674
675
# File 'lib/sendly/types.rb', line 673

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



673
674
675
# File 'lib/sendly/types.rb', line 673

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



673
674
675
# File 'lib/sendly/types.rb', line 673

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



673
674
675
# File 'lib/sendly/types.rb', line 673

def name
  @name
end

Instance Method Details

#to_hObject



683
684
685
686
687
688
# File 'lib/sendly/types.rb', line 683

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