Class: Printaura::Api
- Inherits:
-
Object
- Object
- Printaura::Api
- Defined in:
- lib/printaura/api.rb
Class Method Summary collapse
Class Method Details
.method_missing(m, *args, &block) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/printaura/api.rb', line 5 def self.method_missing(m, *args, &block) #we only really care about the array options = args.last || {} postparams= .update({key: Printaura::Config.API_KEY, hash: Printaura::Config.API_HASH, method: m}).map {|k,v| "#{k}=#{v}"}.join("&") puts postparams result = JSON.parse(HTTParty.post("http://www.api.printaura.com/api.php", body: postparams)) puts result raise result["message"] unless result["status"] return result end |