vuzitruby 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/vuzitcl +163 -9
 - data/lib/vuzitruby/base.rb +2 -5
 - data/lib/vuzitruby/document.rb +16 -6
 - data/lib/vuzitruby/service.rb +1 -1
 - data/lib/vuzitruby.rb +2 -0
 - metadata +5 -6
 
    
        data/bin/vuzitcl
    CHANGED
    
    | 
         @@ -81,6 +81,10 @@ def help_command(args) 
     | 
|
| 
       81 
81 
     | 
    
         
             
                print_usage_load
         
     | 
| 
       82 
82 
     | 
    
         
             
              when "delete"
         
     | 
| 
       83 
83 
     | 
    
         
             
                print_usage_delete
         
     | 
| 
      
 84 
     | 
    
         
            +
              when "page"
         
     | 
| 
      
 85 
     | 
    
         
            +
                print_usage_page
         
     | 
| 
      
 86 
     | 
    
         
            +
              when "event"
         
     | 
| 
      
 87 
     | 
    
         
            +
                print_usage_event
         
     | 
| 
       84 
88 
     | 
    
         
             
              when "upload"
         
     | 
| 
       85 
89 
     | 
    
         
             
                print_usage_upload
         
     | 
| 
       86 
90 
     | 
    
         
             
              when "search"
         
     | 
| 
         @@ -106,6 +110,113 @@ def load_command(args) 
     | 
|
| 
       106 
110 
     | 
    
         
             
                puts "height: #{doc.page_height}"
         
     | 
| 
       107 
111 
     | 
    
         
             
                puts "size: #{doc.file_size}"
         
     | 
| 
       108 
112 
     | 
    
         
             
                puts "status: #{doc.status}"
         
     | 
| 
      
 113 
     | 
    
         
            +
                puts "Download URL: #{Vuzit::Document.download_url(id, 'pdf')}"
         
     | 
| 
      
 114 
     | 
    
         
            +
              rescue Vuzit::ClientException => ex
         
     | 
| 
      
 115 
     | 
    
         
            +
                puts "Error occurred: #{ex.code}, #{ex.message}" 
         
     | 
| 
      
 116 
     | 
    
         
            +
              end
         
     | 
| 
      
 117 
     | 
    
         
            +
            end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
            # Performs the event command.  
         
     | 
| 
      
 120 
     | 
    
         
            +
            def event_command(args)
         
     | 
| 
      
 121 
     | 
    
         
            +
              return if !global_parameters_load(args)
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
              id = args.pop
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
              options = Hash.new
         
     | 
| 
      
 126 
     | 
    
         
            +
              opts = OptionParser.new do |opts|
         
     | 
| 
      
 127 
     | 
    
         
            +
                opts.on("-e", "--event EVENT", "") do |value|
         
     | 
| 
      
 128 
     | 
    
         
            +
                  options[:event] = value
         
     | 
| 
      
 129 
     | 
    
         
            +
                end
         
     | 
| 
      
 130 
     | 
    
         
            +
                
         
     | 
| 
      
 131 
     | 
    
         
            +
                opts.on("-c", "--custom CUSTOM", "") do |value|
         
     | 
| 
      
 132 
     | 
    
         
            +
                  options[:custom] = value
         
     | 
| 
      
 133 
     | 
    
         
            +
                end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                opts.on("-l", "--limit LIMIT", "") do |value|
         
     | 
| 
      
 136 
     | 
    
         
            +
                  options[:limit] = value
         
     | 
| 
      
 137 
     | 
    
         
            +
                end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                opts.on("-o", "--offset OFFSET", "") do |value|
         
     | 
| 
      
 140 
     | 
    
         
            +
                  options[:offset] = value
         
     | 
| 
      
 141 
     | 
    
         
            +
                end
         
     | 
| 
      
 142 
     | 
    
         
            +
              end
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
              begin
         
     | 
| 
      
 145 
     | 
    
         
            +
                opts.parse!(args)
         
     | 
| 
      
 146 
     | 
    
         
            +
              rescue OptionParser::InvalidOption => e
         
     | 
| 
      
 147 
     | 
    
         
            +
                e.recover(args)
         
     | 
| 
      
 148 
     | 
    
         
            +
              end
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
              begin
         
     | 
| 
      
 151 
     | 
    
         
            +
                events = Vuzit::Event.find_all(id, options)
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
                events.each do |event|
         
     | 
| 
      
 154 
     | 
    
         
            +
                  print "[#{event.requested_at.strftime('%Y-%m-%d %H:%M:%S')}] "
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
      
 156 
     | 
    
         
            +
                  if event.event == "page_view"
         
     | 
| 
      
 157 
     | 
    
         
            +
                    print "#{event.duration}s - "
         
     | 
| 
      
 158 
     | 
    
         
            +
                  end
         
     | 
| 
      
 159 
     | 
    
         
            +
                  print "#{event.event}"
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                  if event.page != -1
         
     | 
| 
      
 162 
     | 
    
         
            +
                    print ", p#{event.page}"
         
     | 
| 
      
 163 
     | 
    
         
            +
                  end
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                  if !event.custom.nil?
         
     | 
| 
      
 166 
     | 
    
         
            +
                    print " (#{event.custom})"
         
     | 
| 
      
 167 
     | 
    
         
            +
                  end
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                  if !event.referer.nil?
         
     | 
| 
      
 170 
     | 
    
         
            +
                    print " - #{event.referer[8, 7]}"
         
     | 
| 
      
 171 
     | 
    
         
            +
                  end
         
     | 
| 
      
 172 
     | 
    
         
            +
                  print " - #{event.remote_host}"
         
     | 
| 
      
 173 
     | 
    
         
            +
                  puts " - #{event.user_agent[0, 8]}"
         
     | 
| 
      
 174 
     | 
    
         
            +
                end
         
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
                puts ""
         
     | 
| 
      
 177 
     | 
    
         
            +
                puts "#{events.length} events found"
         
     | 
| 
      
 178 
     | 
    
         
            +
              rescue Vuzit::ClientException => ex
         
     | 
| 
      
 179 
     | 
    
         
            +
                puts "Error occurred: #{ex.code}, #{ex.message}" 
         
     | 
| 
      
 180 
     | 
    
         
            +
              end
         
     | 
| 
      
 181 
     | 
    
         
            +
            end
         
     | 
| 
      
 182 
     | 
    
         
            +
             
     | 
| 
      
 183 
     | 
    
         
            +
            # Performs the page command.  
         
     | 
| 
      
 184 
     | 
    
         
            +
            def page_command(args)
         
     | 
| 
      
 185 
     | 
    
         
            +
              id = args.pop
         
     | 
| 
      
 186 
     | 
    
         
            +
              return if !global_parameters_load(args)
         
     | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
      
 188 
     | 
    
         
            +
              options = Hash.new
         
     | 
| 
      
 189 
     | 
    
         
            +
              opts = OptionParser.new do |opts|
         
     | 
| 
      
 190 
     | 
    
         
            +
                opts.on("-i", "--included [PAGES]", "") do |value|
         
     | 
| 
      
 191 
     | 
    
         
            +
                  options[:included_pages] = value
         
     | 
| 
      
 192 
     | 
    
         
            +
                end
         
     | 
| 
      
 193 
     | 
    
         
            +
                
         
     | 
| 
      
 194 
     | 
    
         
            +
                opts.on("-l", "--limit [LIMIT]", "") do |value|
         
     | 
| 
      
 195 
     | 
    
         
            +
                  options[:limit] = value
         
     | 
| 
      
 196 
     | 
    
         
            +
                end
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
      
 198 
     | 
    
         
            +
                opts.on("-o", "--offset [OFFSET]", "") do |value|
         
     | 
| 
      
 199 
     | 
    
         
            +
                  options[:offset] = value
         
     | 
| 
      
 200 
     | 
    
         
            +
                end
         
     | 
| 
      
 201 
     | 
    
         
            +
              end
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
              begin
         
     | 
| 
      
 204 
     | 
    
         
            +
                opts.parse!(args)
         
     | 
| 
      
 205 
     | 
    
         
            +
              rescue OptionParser::InvalidOption => e
         
     | 
| 
      
 206 
     | 
    
         
            +
                e.recover(args)
         
     | 
| 
      
 207 
     | 
    
         
            +
              end
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
              begin
         
     | 
| 
      
 210 
     | 
    
         
            +
                pages = Vuzit::Page.find_all(id, options)
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
                pages.each do |page|
         
     | 
| 
      
 213 
     | 
    
         
            +
                  puts "Page: #{page.number}"
         
     | 
| 
      
 214 
     | 
    
         
            +
                  puts "#{page.text}"
         
     | 
| 
      
 215 
     | 
    
         
            +
                  puts ''
         
     | 
| 
      
 216 
     | 
    
         
            +
                end
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
                puts ""
         
     | 
| 
      
 219 
     | 
    
         
            +
                puts "#{pages.length} pages found"
         
     | 
| 
       109 
220 
     | 
    
         
             
              rescue Vuzit::ClientException => ex
         
     | 
| 
       110 
221 
     | 
    
         
             
                puts "Error occurred: #{ex.code}, #{ex.message}" 
         
     | 
| 
       111 
222 
     | 
    
         
             
              end
         
     | 
| 
         @@ -128,6 +239,10 @@ def search_command(args) 
     | 
|
| 
       128 
239 
     | 
    
         
             
                opts.on("-o", "--offset [OFFSET]", "") do |value|
         
     | 
| 
       129 
240 
     | 
    
         
             
                  options[:offset] = value
         
     | 
| 
       130 
241 
     | 
    
         
             
                end
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
      
 243 
     | 
    
         
            +
                opts.on("-O", "--output [OUTPUT]", "") do |value|
         
     | 
| 
      
 244 
     | 
    
         
            +
                  options[:output] = value
         
     | 
| 
      
 245 
     | 
    
         
            +
                end
         
     | 
| 
       131 
246 
     | 
    
         
             
              end
         
     | 
| 
       132 
247 
     | 
    
         | 
| 
       133 
248 
     | 
    
         
             
              begin
         
     | 
| 
         @@ -141,16 +256,22 @@ def search_command(args) 
     | 
|
| 
       141 
256 
     | 
    
         | 
| 
       142 
257 
     | 
    
         
             
                docs.each do |doc|
         
     | 
| 
       143 
258 
     | 
    
         
             
                  puts "LOADED: #{doc.id}"
         
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
                   
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
                  if doc.page_count != -1
         
     | 
| 
      
 261 
     | 
    
         
            +
                    puts "title: #{doc.title}"
         
     | 
| 
      
 262 
     | 
    
         
            +
                    puts "subject: #{doc.subject}"
         
     | 
| 
      
 263 
     | 
    
         
            +
                    puts "pages: #{doc.page_count}"
         
     | 
| 
      
 264 
     | 
    
         
            +
                    puts "width: #{doc.page_width}"
         
     | 
| 
      
 265 
     | 
    
         
            +
                    puts "height: #{doc.page_height}"
         
     | 
| 
      
 266 
     | 
    
         
            +
                    puts "size: #{doc.file_size}"
         
     | 
| 
      
 267 
     | 
    
         
            +
                    puts "status: #{doc.status}"
         
     | 
| 
      
 268 
     | 
    
         
            +
                    puts "excerpt: #{doc.excerpt}"
         
     | 
| 
      
 269 
     | 
    
         
            +
                    puts ''
         
     | 
| 
      
 270 
     | 
    
         
            +
                  end
         
     | 
| 
       153 
271 
     | 
    
         
             
                end
         
     | 
| 
      
 272 
     | 
    
         
            +
             
     | 
| 
      
 273 
     | 
    
         
            +
                puts ""
         
     | 
| 
      
 274 
     | 
    
         
            +
                puts "#{docs.length} documents found"
         
     | 
| 
       154 
275 
     | 
    
         
             
              rescue Vuzit::ClientException => ex
         
     | 
| 
       155 
276 
     | 
    
         
             
                puts "Error occurred: #{ex.code}, #{ex.message}" 
         
     | 
| 
       156 
277 
     | 
    
         
             
              end
         
     | 
| 
         @@ -214,12 +335,28 @@ def print_usage_general 
     | 
|
| 
       214 
335 
     | 
    
         
             
              puts "Available commands:"
         
     | 
| 
       215 
336 
     | 
    
         
             
              puts ""
         
     | 
| 
       216 
337 
     | 
    
         
             
              puts "  delete"
         
     | 
| 
      
 338 
     | 
    
         
            +
              puts "  event"
         
     | 
| 
       217 
339 
     | 
    
         
             
              puts "  load"
         
     | 
| 
      
 340 
     | 
    
         
            +
              puts "  page"
         
     | 
| 
       218 
341 
     | 
    
         
             
              puts "  upload"
         
     | 
| 
       219 
342 
     | 
    
         
             
              puts "  search"
         
     | 
| 
       220 
343 
     | 
    
         
             
              puts "  help"
         
     | 
| 
       221 
344 
     | 
    
         
             
            end
         
     | 
| 
       222 
345 
     | 
    
         | 
| 
      
 346 
     | 
    
         
            +
            # Prints the event options
         
     | 
| 
      
 347 
     | 
    
         
            +
            def print_usage_event
         
     | 
| 
      
 348 
     | 
    
         
            +
              puts "page: Loads document event analytics."
         
     | 
| 
      
 349 
     | 
    
         
            +
              puts "usage: event [OPTIONS] WEB_ID"
         
     | 
| 
      
 350 
     | 
    
         
            +
              puts ""
         
     | 
| 
      
 351 
     | 
    
         
            +
              puts "Valid options:"
         
     | 
| 
      
 352 
     | 
    
         
            +
              puts "  -e, --event                    Event type to load"
         
     | 
| 
      
 353 
     | 
    
         
            +
              puts "  -c, --custom                   Custom value to load"
         
     | 
| 
      
 354 
     | 
    
         
            +
              puts "  -l, --limit                    Limits the number of results"
         
     | 
| 
      
 355 
     | 
    
         
            +
              puts "  -o, --offset                   Offset the results at this number"
         
     | 
| 
      
 356 
     | 
    
         
            +
              puts ""
         
     | 
| 
      
 357 
     | 
    
         
            +
              print_usage_global
         
     | 
| 
      
 358 
     | 
    
         
            +
            end
         
     | 
| 
      
 359 
     | 
    
         
            +
             
     | 
| 
       223 
360 
     | 
    
         
             
            # Prints the global options
         
     | 
| 
       224 
361 
     | 
    
         
             
            def print_usage_global
         
     | 
| 
       225 
362 
     | 
    
         
             
              puts "Global Options:"
         
     | 
| 
         @@ -238,6 +375,19 @@ def print_usage_load 
     | 
|
| 
       238 
375 
     | 
    
         
             
              print_usage_global
         
     | 
| 
       239 
376 
     | 
    
         
             
            end
         
     | 
| 
       240 
377 
     | 
    
         | 
| 
      
 378 
     | 
    
         
            +
            # Prints the search options
         
     | 
| 
      
 379 
     | 
    
         
            +
            def print_usage_page
         
     | 
| 
      
 380 
     | 
    
         
            +
              puts "page: Loads page text for a document."
         
     | 
| 
      
 381 
     | 
    
         
            +
              puts "usage: page [OPTIONS] WEB_ID"
         
     | 
| 
      
 382 
     | 
    
         
            +
              puts ""
         
     | 
| 
      
 383 
     | 
    
         
            +
              puts "Valid options:"
         
     | 
| 
      
 384 
     | 
    
         
            +
              puts "  -i, --included                 Set range of pages to load (e.g '5,10-19')"
         
     | 
| 
      
 385 
     | 
    
         
            +
              puts "  -l, --limit                    Limits the results to a number"
         
     | 
| 
      
 386 
     | 
    
         
            +
              puts "  -o, --offset                   Offsets the results at this number"
         
     | 
| 
      
 387 
     | 
    
         
            +
              puts ""
         
     | 
| 
      
 388 
     | 
    
         
            +
              print_usage_global
         
     | 
| 
      
 389 
     | 
    
         
            +
            end
         
     | 
| 
      
 390 
     | 
    
         
            +
             
     | 
| 
       241 
391 
     | 
    
         
             
            # Prints the search options
         
     | 
| 
       242 
392 
     | 
    
         
             
            def print_usage_search
         
     | 
| 
       243 
393 
     | 
    
         
             
              puts "search: Searches for documents within Vuzit."
         
     | 
| 
         @@ -273,6 +423,10 @@ case command 
     | 
|
| 
       273 
423 
     | 
    
         
             
                load_command(ARGV)
         
     | 
| 
       274 
424 
     | 
    
         
             
              when "delete"
         
     | 
| 
       275 
425 
     | 
    
         
             
                delete_command(ARGV)
         
     | 
| 
      
 426 
     | 
    
         
            +
              when "event"
         
     | 
| 
      
 427 
     | 
    
         
            +
                event_command(ARGV)
         
     | 
| 
      
 428 
     | 
    
         
            +
              when "page"
         
     | 
| 
      
 429 
     | 
    
         
            +
                page_command(ARGV)
         
     | 
| 
       276 
430 
     | 
    
         
             
              when "search"
         
     | 
| 
       277 
431 
     | 
    
         
             
                search_command(ARGV)
         
     | 
| 
       278 
432 
     | 
    
         
             
              when "upload"
         
     | 
    
        data/lib/vuzitruby/base.rb
    CHANGED
    
    | 
         @@ -68,17 +68,14 @@ module Vuzit 
     | 
|
| 
       68 
68 
     | 
    
         
             
                end
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
70 
     | 
    
         
             
                # Converts a set of parameters to a URL. 
         
     | 
| 
       71 
     | 
    
         
            -
                def self.parameters_to_url( 
     | 
| 
      
 71 
     | 
    
         
            +
                def self.parameters_to_url(base_url, params)
         
     | 
| 
       72 
72 
     | 
    
         
             
                  params = parameters_clean(params)
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
74 
     | 
    
         
             
                  # The Ruby HTTP library does not want the "http://domain.com" in the 
         
     | 
| 
       75 
75 
     | 
    
         
             
                  # URL as most other libraries do.  If the service URL is provided
         
     | 
| 
       76 
76 
     | 
    
         
             
                  # then less tolerant web servers like IIS will reject it. 
         
     | 
| 
       77 
77 
     | 
    
         
             
                  result = ''
         
     | 
| 
       78 
     | 
    
         
            -
                  result << "/" <<  
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                  result << ("/" << id) if !id.nil?
         
     | 
| 
       81 
     | 
    
         
            -
                  result << "." << extension << "?"
         
     | 
| 
      
 78 
     | 
    
         
            +
                  result << "/" << base_url << "?"
         
     | 
| 
       82 
79 
     | 
    
         | 
| 
       83 
80 
     | 
    
         
             
                  params.each_pair do |key, value|
         
     | 
| 
       84 
81 
     | 
    
         
             
                    result << (key.to_s << "=" << CGI.escape(value.to_s) << "&")
         
     | 
    
        data/lib/vuzitruby/document.rb
    CHANGED
    
    | 
         @@ -25,8 +25,10 @@ module Vuzit 
     | 
|
| 
       25 
25 
     | 
    
         
             
                # Deletes a document by the ID.  Returns true if it succeeded.  It throws
         
     | 
| 
       26 
26 
     | 
    
         
             
                # a Vuzit::ClientException on failure.  It returns _true_ on success.  
         
     | 
| 
       27 
27 
     | 
    
         
             
                def self.destroy(id)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  raise Vuzit::ClientException.new("id cannot be null") if id.nil?
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       28 
30 
     | 
    
         
             
                  params = post_parameters("destroy", nil, id)
         
     | 
| 
       29 
     | 
    
         
            -
                  url = parameters_to_url("documents", params 
     | 
| 
      
 31 
     | 
    
         
            +
                  url = parameters_to_url("documents/#{id}.xml", params)
         
     | 
| 
       30 
32 
     | 
    
         
             
                  http = http_connection
         
     | 
| 
       31 
33 
     | 
    
         | 
| 
       32 
34 
     | 
    
         
             
                  request = Net::HTTP::Delete.new(url, {'User-Agent' => Vuzit::Service.user_agent})
         
     | 
| 
         @@ -56,16 +58,20 @@ module Vuzit 
     | 
|
| 
       56 
58 
     | 
    
         | 
| 
       57 
59 
     | 
    
         
             
                # Returns a download URL. 
         
     | 
| 
       58 
60 
     | 
    
         
             
                def self.download_url(id, file_extension)
         
     | 
| 
      
 61 
     | 
    
         
            +
                  raise Vuzit::ClientException.new("id cannot be null") if id.nil?
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
       59 
63 
     | 
    
         
             
                  params = post_parameters("show", nil, id)
         
     | 
| 
       60 
     | 
    
         
            -
                  return  
     | 
| 
      
 64 
     | 
    
         
            +
                  return Vuzit::Service.service_url + 
         
     | 
| 
      
 65 
     | 
    
         
            +
                         parameters_to_url("documents/#{id}.#{file_extension}", params)
         
     | 
| 
       61 
66 
     | 
    
         
             
                end
         
     | 
| 
       62 
67 
     | 
    
         | 
| 
       63 
68 
     | 
    
         
             
                # Finds a document by the ID.  It throws a Vuzit::ClientException on failure. 
         
     | 
| 
       64 
69 
     | 
    
         
             
                def self.find(id, options = {})
         
     | 
| 
       65 
70 
     | 
    
         
             
                  raise ArgumentError, "Options must be a hash" unless options.kind_of? Hash
         
     | 
| 
      
 71 
     | 
    
         
            +
                  raise Vuzit::ClientException.new("id cannot be null") if id.nil?
         
     | 
| 
       66 
72 
     | 
    
         | 
| 
       67 
73 
     | 
    
         
             
                  params = post_parameters("show", options, id)
         
     | 
| 
       68 
     | 
    
         
            -
                  url = parameters_to_url("documents", params 
     | 
| 
      
 74 
     | 
    
         
            +
                  url = parameters_to_url("documents/#{id}.xml", params)
         
     | 
| 
       69 
75 
     | 
    
         
             
                  http = http_connection
         
     | 
| 
       70 
76 
     | 
    
         | 
| 
       71 
77 
     | 
    
         
             
                  request = Net::HTTP::Get.new(url, {'User-Agent' => Vuzit::Service.user_agent})
         
     | 
| 
         @@ -103,9 +109,8 @@ module Vuzit 
     | 
|
| 
       103 
109 
     | 
    
         
             
                  raise ArgumentError, "Options must be a hash" unless options.kind_of? Hash
         
     | 
| 
       104 
110 
     | 
    
         | 
| 
       105 
111 
     | 
    
         
             
                  result = Array.new
         
     | 
| 
       106 
     | 
    
         
            -
                  options[:output] = "summary"
         
     | 
| 
       107 
112 
     | 
    
         
             
                  params = post_parameters("index", options)
         
     | 
| 
       108 
     | 
    
         
            -
                  url = parameters_to_url("documents", params)
         
     | 
| 
      
 113 
     | 
    
         
            +
                  url = parameters_to_url("documents.xml", params)
         
     | 
| 
       109 
114 
     | 
    
         
             
                  http = http_connection
         
     | 
| 
       110 
115 
     | 
    
         | 
| 
       111 
116 
     | 
    
         
             
                  request = Net::HTTP::Get.new(url, {'User-Agent' => Vuzit::Service.user_agent})
         
     | 
| 
         @@ -193,7 +198,12 @@ module Vuzit 
     | 
|
| 
       193 
198 
     | 
    
         
             
                def self.xml_to_document(node)
         
     | 
| 
       194 
199 
     | 
    
         
             
                  result = Vuzit::Document.new
         
     | 
| 
       195 
200 
     | 
    
         | 
| 
       196 
     | 
    
         
            -
                   
     | 
| 
      
 201 
     | 
    
         
            +
                  id = node_value(node, "web_id")
         
     | 
| 
      
 202 
     | 
    
         
            +
                  if id == nil
         
     | 
| 
      
 203 
     | 
    
         
            +
                    raise Vuzit::ClientException.new("Unknown error occurred: #{response_body}");
         
     | 
| 
      
 204 
     | 
    
         
            +
                  end
         
     | 
| 
      
 205 
     | 
    
         
            +
             
     | 
| 
      
 206 
     | 
    
         
            +
                  result.send(:set_id, id)
         
     | 
| 
       197 
207 
     | 
    
         
             
                  result.send(:set_title, node_value(node, 'title'))
         
     | 
| 
       198 
208 
     | 
    
         
             
                  result.send(:set_subject, node_value(node, 'subject'))
         
     | 
| 
       199 
209 
     | 
    
         
             
                  result.send(:set_page_count, node_value_int(node, 'page_count'))
         
     | 
    
        data/lib/vuzitruby/service.rb
    CHANGED
    
    | 
         @@ -47,7 +47,7 @@ module Vuzit 
     | 
|
| 
       47 
47 
     | 
    
         
             
                @@public_key = nil
         
     | 
| 
       48 
48 
     | 
    
         
             
                @@private_key = nil
         
     | 
| 
       49 
49 
     | 
    
         
             
                @@service_url = 'http://vuzit.com'
         
     | 
| 
       50 
     | 
    
         
            -
                @@product_name = 'VuzitRuby Library 2. 
     | 
| 
      
 50 
     | 
    
         
            +
                @@product_name = 'VuzitRuby Library 2.1.0'
         
     | 
| 
       51 
51 
     | 
    
         
             
                @@user_agent = @@product_name
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
                # TODO: For all of the set variables do not allow nil values
         
     | 
    
        data/lib/vuzitruby.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: vuzitruby
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Brent Matzelle
         
     | 
| 
         @@ -9,14 +9,13 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2010- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2010-04-20 00:00:00 -04:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: vuzitcl
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
            description: |-
         
     | 
| 
       17 
     | 
    
         
            -
               
     | 
| 
       18 
     | 
    
         
            -
                                    
     | 
| 
       19 
     | 
    
         
            -
                                   http://vuzit.com/developer
         
     | 
| 
      
 17 
     | 
    
         
            +
              Code library that allows developers to directly access 
         
     | 
| 
      
 18 
     | 
    
         
            +
                                   the Vuzit Document Viewer Web Service API through Ruby.
         
     | 
| 
       20 
19 
     | 
    
         
             
            email: support@vuzit.com
         
     | 
| 
       21 
20 
     | 
    
         
             
            executables: 
         
     | 
| 
       22 
21 
     | 
    
         
             
            - vuzitcl
         
     | 
| 
         @@ -33,7 +32,7 @@ files: 
     | 
|
| 
       33 
32 
     | 
    
         
             
            - lib/vuzitruby/client_exception.rb
         
     | 
| 
       34 
33 
     | 
    
         
             
            - lib/vuzitruby/service.rb
         
     | 
| 
       35 
34 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
       36 
     | 
    
         
            -
            homepage: http:// 
     | 
| 
      
 35 
     | 
    
         
            +
            homepage: http://wiki.github.com/vuzit/vuzitruby/
         
     | 
| 
       37 
36 
     | 
    
         
             
            licenses: []
         
     | 
| 
       38 
37 
     | 
    
         | 
| 
       39 
38 
     | 
    
         
             
            post_install_message: 
         
     |