Class: Hashie::Links

Inherits:
Object
  • Object
show all
Defined in:
lib/desk/deash.rb

Instance Method Summary collapse

Constructor Details

#initialize(links) ⇒ Links

Returns a new instance of Links.



6
7
8
# File 'lib/desk/deash.rb', line 6

def initialize(links)
  @links = links
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



10
11
12
13
14
15
16
# File 'lib/desk/deash.rb', line 10

def method_missing(method, *args, &block)
  if @links.key?(method)
    return nil if !@links[method]
    return Desk.get(@links[method].href.sub("/api/#{Desk.version}/", ""))
  end
  return super
end