lib/virility/strategy.rb in virility-0.1.4 vs lib/virility/strategy.rb in virility-0.2.0
- old
+ new
@@ -1,17 +1,18 @@
module Virility
class Strategy
include HTTParty
include Virility::Supporter
- attr_accessor :url, :response, :results
+ attr_accessor :url, :response, :results, :original_url
def initialize url
- @url = encode url
+ @original_url = url
+ @url = encode(url)
@results = {}
end
-
+
#
# Abstract Methods - Delete eventually
#
def census
@@ -19,31 +20,31 @@
end
def count
raise "Abstract Method count called on #{self.class} - Please define this method"
end
-
+
#
# Poll
#
-
+
def poll
call_strategy
collect_results
end
-
+
#
# Call Strategy
#
-
+
def call_strategy
@response = census
end
#
# Results
#
-
+
def collect_results
if respond_to?(:outcome)
@results = valid_response_test ? outcome : {}
else
@results = valid_response_test ? @response.parsed_response : {}
\ No newline at end of file