Class: Atum::Core::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/atum/core/resource.rb

Overview

A resource with methods mapped to API links.

Instance Method Summary collapse

Constructor Details

#initialize(links) ⇒ Resource

Instantiate a resource.

Parameters:

  • links (Hash<String,Link>)

    A hash that maps method names to links.



8
9
10
11
12
# File 'lib/atum/core/resource.rb', line 8

def initialize(links)
  links.each do |name, link|
    define_singleton_method(name) { |*args| link.run(*args) }
  end
end