Class: Stargate::Response::ScannerResponse
- Inherits:
-
BasicResponse
- Object
- BasicResponse
- Stargate::Response::ScannerResponse
- Defined in:
- lib/stargate/response/scanner_response.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
-
#initialize(raw_data, method) ⇒ ScannerResponse
constructor
A new instance of ScannerResponse.
- #parse_content(raw_data) ⇒ Object
Methods inherited from BasicResponse
Constructor Details
#initialize(raw_data, method) ⇒ ScannerResponse
Returns a new instance of ScannerResponse.
6 7 8 9 |
# File 'lib/stargate/response/scanner_response.rb', line 6 def initialize(raw_data, method) @method = method super(raw_data) end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/stargate/response/scanner_response.rb', line 4 def method @method end |
Instance Method Details
#parse_content(raw_data) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/stargate/response/scanner_response.rb', line 11 def parse_content(raw_data) case @method when :open_scanner case raw_data when Net::HTTPCreated Stargate::Model::Scanner.new(:scanner_url => raw_data["Location"]) else if raw_data..include?("TableNotFoundException") raise TableNotFoundError, "Table #{table_name} Not Found!" else raise StandardError, "Unable to open scanner. Received the following message: #{raw_data.}" end end when :get_rows # Dispatch it to RowResponse, since that method is made # to deal with rows already. RowResponse.new(raw_data, :show_row).parse when :close_scanner case raw_data when Net::HTTPOK return true else raise StandardError, "Unable to close scanner. Received the following message: #{raw_data.}" end else puts "method '#{@method}' not supported yet" end end |