lib/cloudkick/node.rb in cloudkick-0.2.8 vs lib/cloudkick/node.rb in cloudkick-0.2.9
- old
+ new
@@ -10,10 +10,11 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'crack'
+require 'uri'
module Cloudkick
class Node < Base
attr_reader :agent_state, :color, :id, :ipaddress, :name
@@ -52,10 +53,11 @@
@nodes.each { |node| yield node }
end
def get
if @query
- resp, data = access_token.get("/1.0/query/nodes?query=#{query}")
+ escaped = URI.escape(@query)
+ resp, data = access_token.get("/1.0/query/nodes?query=#{escaped}")
else
resp, data = access_token.get("/1.0/query/nodes")
end
hash = Crack::JSON.parse(data)