Class: Susuwatari::Client
- Inherits:
-
Object
- Object
- Susuwatari::Client
- Extended by:
- Forwardable
- Defined in:
- lib/susuwatari/client.rb
Constant Summary collapse
- TEST_URL =
'http://www.webpagetest.org/runtest.php'
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Client
constructor
A new instance of Client.
- #result ⇒ Object
- #run ⇒ Object
- #status ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 17 18 |
# File 'lib/susuwatari/client.rb', line 11 def initialize( params = {} ) params.fetch(:k) params.fetch(:url) params[:f] = :json params[:runs] ||= 1 params.delete(:r) self.params = params end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
5 6 7 |
# File 'lib/susuwatari/client.rb', line 5 def params @params end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/susuwatari/client.rb', line 5 def response @response end |
Instance Method Details
#result ⇒ Object
26 27 28 |
# File 'lib/susuwatari/client.rb', line 26 def result @result && @result.test_result || {} end |
#run ⇒ Object
20 21 22 23 24 |
# File 'lib/susuwatari/client.rb', line 20 def run return status if @result @result = Result.new(make_request) @result.test_id end |
#status ⇒ Object
30 31 32 |
# File 'lib/susuwatari/client.rb', line 30 def status @result && @result.status || :to_be_run end |