Class: Hook0::Generated::Problem
- Inherits:
-
Object
- Object
- Hook0::Generated::Problem
- Defined in:
- lib/hook0/generated/models.rb
Overview
The Problem the API declares.
Instance Attribute Summary collapse
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#validation ⇒ Object
readonly
Returns the value of attribute validation.
Class Method Summary collapse
-
.from_json(value) ⇒ Problem
Read one out of what the API answered.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Whether that value carries the same members as this one.
-
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
-
#initialize(detail:, id:, status:, title:, type:, validation: nil) ⇒ Problem
constructor
A new instance of Problem.
-
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
Constructor Details
#initialize(detail:, id:, status:, title:, type:, validation: nil) ⇒ Problem
Returns a new instance of Problem.
1991 1992 1993 1994 1995 1996 1997 1998 1999 |
# File 'lib/hook0/generated/models.rb', line 1991 def initialize(detail:, id:, status:, title:, type:, validation: nil) @detail = detail @id = id @status = status @title = title @type = type @validation = validation freeze end |
Instance Attribute Details
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
1973 1974 1975 |
# File 'lib/hook0/generated/models.rb', line 1973 def detail @detail end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
1973 1974 1975 |
# File 'lib/hook0/generated/models.rb', line 1973 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
1973 1974 1975 |
# File 'lib/hook0/generated/models.rb', line 1973 def status @status end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
1973 1974 1975 |
# File 'lib/hook0/generated/models.rb', line 1973 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
1973 1974 1975 |
# File 'lib/hook0/generated/models.rb', line 1973 def type @type end |
#validation ⇒ Object (readonly)
Returns the value of attribute validation.
1973 1974 1975 |
# File 'lib/hook0/generated/models.rb', line 1973 def validation @validation end |
Class Method Details
.from_json(value) ⇒ Problem
Read one out of what the API answered.
2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 |
# File 'lib/hook0/generated/models.rb', line 2005 def self.from_json(value) fields = Runtime.as_fields(value, "Problem") new( detail: Runtime.read(fields, "detail", Runtime::TEXT), id: Runtime.read(fields, "id", Runtime.member_of(ProblemId)), status: Runtime.read(fields, "status", Runtime::INTEGER), title: Runtime.read(fields, "title", Runtime::TEXT), type: Runtime.read(fields, "type", Runtime::TEXT), validation: Runtime.maybe(fields, "validation", Runtime::JSON_VALUE) ) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Whether that value carries the same members as this one.
2035 2036 2037 |
# File 'lib/hook0/generated/models.rb', line 2035 def ==(other) other.is_a?(Problem) && to_h == other.to_h end |
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
2043 2044 2045 |
# File 'lib/hook0/generated/models.rb', line 2043 def hash to_h.hash end |
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 |
# File 'lib/hook0/generated/models.rb', line 2020 def to_h out = {} out["detail"] = @detail out["id"] = @id out["status"] = @status out["title"] = @title out["type"] = @type out["validation"] = @validation unless @validation.nil? out end |