Class: Retab::SchemaGeneration
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::SchemaGeneration
- Defined in:
- lib/retab/schemas/schema_generation.rb
Constant Summary collapse
- HASH_ATTRS =
{ object: :object, created_at: :created_at, json_schema: :json_schema, strict: :strict, id: :id, status: :status, error: :error }.freeze
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#error ⇒ Object
Returns the value of attribute error.
-
#id ⇒ Object
Returns the value of attribute id.
-
#json_schema ⇒ Object
Returns the value of attribute json_schema.
-
#object ⇒ Object
Returns the value of attribute object.
-
#status ⇒ Object
Returns the value of attribute status.
-
#strict ⇒ Object
Returns the value of attribute strict.
Attributes inherited from Types::BaseModel
Instance Method Summary collapse
-
#initialize(json) ⇒ SchemaGeneration
constructor
A new instance of SchemaGeneration.
Methods inherited from Types::BaseModel
deep_symbolize, #inspect, normalize, #to_h, #to_json
Constructor Details
#initialize(json) ⇒ SchemaGeneration
Returns a new instance of SchemaGeneration.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/retab/schemas/schema_generation.rb', line 28 def initialize(json) super() hash = self.class.normalize(json) @object = hash[:object].nil? ? "schema" : hash[:object] @created_at = hash[:created_at] @json_schema = hash[:json_schema] || {} @strict = hash[:strict].nil? ? true : hash[:strict] @id = hash[:id] @status = hash[:status].nil? ? "pending" : hash[:status] @error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
18 19 20 |
# File 'lib/retab/schemas/schema_generation.rb', line 18 def created_at @created_at end |
#error ⇒ Object
Returns the value of attribute error.
18 19 20 |
# File 'lib/retab/schemas/schema_generation.rb', line 18 def error @error end |
#id ⇒ Object
Returns the value of attribute id.
18 19 20 |
# File 'lib/retab/schemas/schema_generation.rb', line 18 def id @id end |
#json_schema ⇒ Object
Returns the value of attribute json_schema.
18 19 20 |
# File 'lib/retab/schemas/schema_generation.rb', line 18 def json_schema @json_schema end |
#object ⇒ Object
Returns the value of attribute object.
18 19 20 |
# File 'lib/retab/schemas/schema_generation.rb', line 18 def object @object end |
#status ⇒ Object
Returns the value of attribute status.
18 19 20 |
# File 'lib/retab/schemas/schema_generation.rb', line 18 def status @status end |
#strict ⇒ Object
Returns the value of attribute strict.
18 19 20 |
# File 'lib/retab/schemas/schema_generation.rb', line 18 def strict @strict end |