Class: Troo::API::Endpoints

Inherits:
Object
  • Object
show all
Defined in:
lib/troo/api/endpoints.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, value = {}) ⇒ Troo::API::Endpoints

Parameters:

  • (Symbol)
  • (Hash)


16
17
18
# File 'lib/troo/api/endpoints.rb', line 16

def initialize(endpoint, value = {})
  @endpoint, @value = endpoint, value
end

Class Method Details

.interpolate(endpoint, value = {}) ⇒ String, EndpointNotFound

Parameters:

  • (Symbol)
  • (Hash)

Returns:



8
9
10
# File 'lib/troo/api/endpoints.rb', line 8

def interpolate(endpoint, value = {})
  new(endpoint, value).interpolate
end

Instance Method Details

#interpolateString, EndpointNotFound

Parameters:

  • (Symbol)
  • (Hash)

Returns:



23
24
25
26
27
# File 'lib/troo/api/endpoints.rb', line 23

def interpolate
  endpoints.fetch(endpoint) % value
rescue KeyError
  fail EndpointNotFound
end