Class: Esha::Api

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/esha/api.rb

Direct Known Subclasses

Food, Nutrient

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/esha/api.rb', line 13

def method_missing(method, *args)
  if @attributes.keys.include?(method.to_s)
    @attributes[method.to_s]
  else
    super
  end
end

Class Method Details

.key=(key) ⇒ Object



9
10
11
# File 'lib/esha/api.rb', line 9

def self.key=(key)
  default_params apikey: key
end