Class: Spriv::Client
- Inherits:
-
Object
- Object
- Spriv::Client
- Defined in:
- lib/spriv/client.rb
Constant Summary collapse
- BASE_URI =
'https://m.spriv.com/wsM5.asmx/'
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/spriv/client.rb', line 5 def method_missing(m, *args, &block) begin uri = URI(BASE_URI + prepare_path(m)) response = Net::HTTP.post_form(uri, (args[0])) JSON.parse(response.body) rescue Exception => e { message: e. } end end |