Class: Geet::Github::Label
- Inherits:
-
Object
- Object
- Geet::Github::Label
- Extended by:
- T::Sig
- Defined in:
- lib/geet/github/label.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, color) ⇒ Label
constructor
A new instance of Label.
Constructor Details
#initialize(name, color) ⇒ Label
Returns a new instance of Label.
21 22 23 24 |
# File 'lib/geet/github/label.rb', line 21 def initialize(name, color) @name = name @color = color end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
13 14 15 |
# File 'lib/geet/github/label.rb', line 13 def color @color end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/geet/github/label.rb', line 10 def name @name end |
Class Method Details
.create(name, color, api_interface) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/geet/github/label.rb', line 51 def self.create(name, color, api_interface) api_path = "labels" request_data = {name:, color:} api_interface.send_request(api_path, data: request_data) new(name, color) end |
.list(api_interface) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/geet/github/label.rb', line 31 def self.list(api_interface) api_path = "labels" response = T.cast(api_interface.send_request(api_path, multipage: true), T::Array[T::Hash[String, T.untyped]]) response.map do |label_entry| name = T.cast(label_entry.fetch("name"), String) color = T.cast(label_entry.fetch("color"), String) new(name, color) end end |