module Round
  class Base
    attr_reader :resource

    def initialize(options = {})
      raise ArgumentError, 'A resource must be set on this object' unless options[:resource]
      @resource = options[:resource]
      @client = options[:client]
    end

    def refresh
      @resource = @resource.get
      self
    end

    def method_missing(meth, *args, &block)
      @resource.send(meth, *args, &block)
    rescue
      @resource.attributes[meth]
    end

    def hash_identifier
      send :[], self.class.hash_identifier
    end

    def self.hash_identifier
      "key"
    end

    def self.association(name, klass)
      class_eval %Q{
        def #{name}
          #{klass}.new(resource: @resource.#{name}, client: @client)
        end
      }
    end

  end
end
module Round
  class Base
    attr_reader :resource

    def initialize(options = {})
      raise ArgumentError, 'A resource must be set on this object' unless options[:resource]
      @resource = options[:resource]
      @client = options[:client]
    end

    def refresh
      @resource = @resource.get
      self
    end

    def method_missing(meth, *args, &block)
      @resource.send(meth, *args, &block)
    rescue
      @resource.attributes[meth]
    end

    def hash_identifier
      send :[], self.class.hash_identifier
    end

    def self.hash_identifier
      "key"
    end

    def self.association(name, klass)
      define_method(name) do
        Kernel.const_get(klass).new(resource: @resource.send(name), client: @client)
      end
    end

  end
end

Remove 'eval' usage from association macro
Remove 'eval' usage from association macro

The Association macro found in Round::Base used
`class_eval`, which is somewhat evil.

Change the logic to utilize safer and slightly more direct
metaprogramming methods, like `define_method` and `const_get`.
