Class: ShotgunApiRuby::Entity

Inherits:
Struct
  • Object
show all
Defined in:
lib/shotgun_api_ruby/entity.rb

Overview

Represent each entity returned by Shotgun

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/shotgun_api_ruby/entity.rb', line 7

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

#attributesObject

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes



5
6
7
# File 'lib/shotgun_api_ruby/entity.rb', line 5

def attributes
  @attributes
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



5
6
7
# File 'lib/shotgun_api_ruby/entity.rb', line 5

def id
  @id
end

Returns the value of attribute links

Returns:

  • (Object)

    the current value of links



5
6
7
# File 'lib/shotgun_api_ruby/entity.rb', line 5

def links
  @links
end

#relationshipsObject

Returns the value of attribute relationships

Returns:

  • (Object)

    the current value of relationships



5
6
7
# File 'lib/shotgun_api_ruby/entity.rb', line 5

def relationships
  @relationships
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



5
6
7
# File 'lib/shotgun_api_ruby/entity.rb', line 5

def type
  @type
end

Instance Method Details

#respond_to_missing?(name, _private_methods = false) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/shotgun_api_ruby/entity.rb', line 16

def respond_to_missing?(name, _private_methods = false)
  attributes.respond_to?(name) || super
end