Class: Wormly
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, args = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/wormly/wormly.rb', line 12 def method_missing(name, args = {}) args[:key] = ENV["WORMLY_API_KEY"] args[:response] = "json" args[:cmd] = name.to_s.split("_").map(&:capitalize).join args[:cmd][0..0] = args[:cmd][0..0].downcase response = OpenStruct.new(self.class.post("/", :query => args)) raise response.errormsg unless response.errorcode.zero? response end |