Class: Evostream::Client
- Inherits:
-
Object
- Object
- Evostream::Client
- Defined in:
- lib/evostream/client.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/evostream/client.rb', line 11 def initialize( = {}) # Merge the config values from the module and those passed # to the client. = Evostream..merge() # Copy the merged values to this client and ignore those # not part of our configuration Configuration::VALID_CONFIG_KEYS.each do |key| send("#{key}=", [key]) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/evostream/client.rb', line 23 def method_missing(method, *args) params = !args.empty? ? encode_params(args.first) : {} response = RestClient.get(service_url(method), { :params => params }) json = JSON.parse(response.body) if json['status'] == 'SUCCESS' json['data'] else super end end |