Class: ShotgridApiRuby::Entity
- Inherits:
-
T::Struct
- Object
- T::Struct
- ShotgridApiRuby::Entity
- Extended by:
- T::Sig
- Defined in:
- lib/shotgrid_api_ruby/entity.rb
Overview
Represent each entity returned by Shotgrid
Instance Attribute Summary collapse
-
#attributes ⇒ OpenStruct
readonly
Returns the value of attribute `attributes`.
-
#id ⇒ Integer
readonly
Returns the value of attribute `id`.
-
#links ⇒ Hash{String => String}
readonly
Returns the value of attribute `links`.
-
#relationships ⇒ Hash{T.untyped => T.untyped}
readonly
Returns the value of attribute `relationships`.
-
#type ⇒ String
readonly
.new(:type, :attributes, :relationships, :id, :links) do.
Instance Method Summary collapse
- #initialize(type:, attributes:, relationships:, id:, links:) ⇒ void constructor
- #method_missing(name, *args, &block) ⇒ T.untyped
- #respond_to_missing?(name, _private_methods = false) ⇒ Boolean
Constructor Details
#initialize(type:, attributes:, relationships:, id:, links:) ⇒ void
|
# File '' const :type, String const :attributes, OpenStruct const :relationships, T::Hash[T.untyped, T.untyped] const :id, Integer const :links, T::Hash[String, String] |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ T.untyped
20 21 22 23 24 25 26 27 |
# File 'lib/shotgrid_api_ruby/entity.rb', line 20 def method_missing(name, *args, &block) if attributes.respond_to?(name) define_singleton_method(name) { attributes.public_send(name) } public_send(name) else super end end |
Instance Attribute Details
#attributes ⇒ OpenStruct (readonly)
Returns the value of attribute `attributes`.
|
# File '' const :attributes, OpenStruct |
#id ⇒ Integer (readonly)
Returns the value of attribute `id`.
|
# File '' const :id, Integer |
#links ⇒ Hash{String => String} (readonly)
Returns the value of attribute `links`.
|
# File '' const :links, T::Hash[String, String] |
#relationships ⇒ Hash{T.untyped => T.untyped} (readonly)
Returns the value of attribute `relationships`.
|
# File '' const :relationships, T::Hash[T.untyped, T.untyped] |
#type ⇒ String (readonly)
.new(:type, :attributes, :relationships, :id, :links) do
|
# File '' const :type, String |
Instance Method Details
#respond_to_missing?(name, _private_methods = false) ⇒ Boolean
33 34 35 |
# File 'lib/shotgrid_api_ruby/entity.rb', line 33 def respond_to_missing?(name, _private_methods = false) attributes.respond_to?(name) || super end |