Class: Netstats24::Client
- Inherits:
-
Object
- Object
- Netstats24::Client
- Defined in:
- lib/netstats24-client.rb,
lib/netstats24-client/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#server_url ⇒ Object
Returns the value of attribute server_url.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Client
constructor
A new instance of Client.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/netstats24-client.rb', line 9 def initialize opts = {} default_server = ENV['RAILS_ENV'] == 'test' ? 'http://localhost:3000/api2' : 'http://api.netstats24.ru/api2' self.server_url = opts[:server_url] || default_server self.access_token = opts[:access_token] || ask_for_token(opts) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
22 23 24 25 |
# File 'lib/netstats24-client.rb', line 22 def method_missing method, *args # warn "method missing: #{method}, #{args.inspect}" send_request method, *args end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
20 21 22 |
# File 'lib/netstats24-client.rb', line 20 def access_token @access_token end |
#server_url ⇒ Object
Returns the value of attribute server_url.
20 21 22 |
# File 'lib/netstats24-client.rb', line 20 def server_url @server_url end |