Sha256: 0d5fb4e67f140a08b229089b38850d0b764050098831252f2a669c9627af6105

Contents?: true

Size: 548 Bytes

Versions: 5

Compression:

Stored size: 548 Bytes

Contents

# frozen_string_literal: true

module ShotgridApiRuby
  # Represent each entity returned by Shotgrid
  Entity =
    Struct.new(:type, :attributes, :relationships, :id, :links) do
      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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shotgrid_api_ruby-0.1.3.3 lib/shotgrid_api_ruby/entity.rb
shotgrid_api_ruby-0.1.3.2 lib/shotgrid_api_ruby/entity.rb
shotgrid_api_ruby-0.1.3.1 lib/shotgrid_api_ruby/entity.rb
shotgrid_api_ruby-0.1.3 lib/shotgrid_api_ruby/entity.rb
shotgrid_api_ruby-0.1.2 lib/shotgrid_api_ruby/entity.rb