I am trying to use HTTParty in my thor but it is not working. All I wish
to do is use HTTParty *get* to query couchdb in my method xyz

require 'json'
require 'httparty'
require 'thor'

class FindXyz < Thor
  include Thor::Actions

  include HTTParty
    headers 'Accept' => 'application/json'
    server = '192.168.5.50:5984'
    user = 'uname'
    password = 'passo'

    couchdb_url = "http://#{user}:#{password}@#{server}"
    basic_auth user, password
    base_uri couchdb_url
    default_params :output => 'json'
    format :json

    desc "xyz", "Find scenarios that contains SSL"
    method_option :name, :aliases => "-t", :required => true
    method_option :location, :aliases => "-s",:required => true

    def xyz
      name = options[:name]
      loc = options[:location]
      file_path = File.join(loc, name)

      t_json = JSON.parse(File.read(file_path))

     t_json["ids"].each do |temp|
       path_to_doc = "/test123/#{temp}"
       response = get(path_to_doc)
       puts "Found => #{temp}" if response.to_s.include?('Birdy')
    end

   end
end

-- 
Posted via http://www.ruby-forum.com/.