Class: RippyRules::Client
- Inherits:
-
Object
- Object
- RippyRules::Client
show all
- Includes:
- HTTParty
- Defined in:
- lib/rippy_rules/rippy_rules.rb
Instance Method Summary
collapse
Constructor Details
#initialize(username, password) ⇒ Client
Returns a new instance of Client.
8
9
10
11
12
|
# File 'lib/rippy_rules/rippy_rules.rb', line 8
def initialize(username, password)
@username = username
@password = password
authenticate
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *params) ⇒ Object
18
19
20
21
22
|
# File 'lib/rippy_rules/rippy_rules.rb', line 18
def method_missing(method, *params)
first_param = params.first
raise APIError unless first_param.is_a?(Hash)
perform_request(method.to_s,first_param)
end
|
Instance Method Details
24
25
26
|
# File 'lib/rippy_rules/rippy_rules.rb', line 24
def perform_request(method, query={})
self.class.get("/ajax.php", :query => query.merge({action: method}))
end
|
#search(str) ⇒ Object
14
15
16
|
# File 'lib/rippy_rules/rippy_rules.rb', line 14
def search(str)
browse({searchstr: str})
end
|