Class: E2B::Models::TemplateTag
- Inherits:
-
Object
- Object
- E2B::Models::TemplateTag
- Defined in:
- lib/e2b/models/template_tag.rb
Instance Attribute Summary collapse
-
#build_id ⇒ Object
readonly
Returns the value of attribute build_id.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(tag:, build_id:, created_at:) ⇒ TemplateTag
constructor
A new instance of TemplateTag.
Constructor Details
#initialize(tag:, build_id:, created_at:) ⇒ TemplateTag
Returns a new instance of TemplateTag.
18 19 20 21 22 |
# File 'lib/e2b/models/template_tag.rb', line 18 def initialize(tag:, build_id:, created_at:) @tag = tag @build_id = build_id @created_at = created_at end |
Instance Attribute Details
#build_id ⇒ Object (readonly)
Returns the value of attribute build_id.
8 9 10 |
# File 'lib/e2b/models/template_tag.rb', line 8 def build_id @build_id end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
8 9 10 |
# File 'lib/e2b/models/template_tag.rb', line 8 def created_at @created_at end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
8 9 10 |
# File 'lib/e2b/models/template_tag.rb', line 8 def tag @tag end |
Class Method Details
.from_hash(data) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/e2b/models/template_tag.rb', line 10 def self.from_hash(data) new( tag: data["tag"] || data[:tag], build_id: data["buildID"] || data["build_id"] || data[:buildID], created_at: parse_time(data["createdAt"] || data["created_at"] || data[:createdAt]) ) end |
.parse_time(value) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/e2b/models/template_tag.rb', line 24 def self.parse_time(value) return nil if value.nil? return value if value.is_a?(Time) Time.parse(value) rescue ArgumentError nil end |