vuzitruby 1.0.0 → 1.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.
Files changed (5) hide show
  1. data/README +2 -1
  2. data/Rakefile +4 -2
  3. data/bin/vuzitcl +130 -0
  4. data/lib/vuzitruby/service.rb +1 -0
  5. metadata +4 -4
data/README CHANGED
@@ -26,7 +26,7 @@ private keys with the keys from your account.
26
26
 
27
27
  The client library is a RubyGem called *vuzitruby*. To install, type:
28
28
 
29
- sudo gem install vuzitruby
29
+ gem install vuzitruby
30
30
 
31
31
  == GETTING STARTED
32
32
 
@@ -34,6 +34,7 @@ The client library is a RubyGem called *vuzitruby*. To install, type:
34
34
  * Sign up for a free Vuzit account - https://ssl.vuzit.com/signup
35
35
  * Code Examples - http://wiki.github.com/vuzit/vuzitruby/code-examples
36
36
  * Vuzit API Reference - http://doc.vuzit.com/vuzitruby
37
+ * VuzitCL Command Line - http://wiki.github.com/vuzit/vuzitruby/vuzitcl
37
38
 
38
39
  == EXAMPLES
39
40
 
data/Rakefile CHANGED
@@ -3,11 +3,13 @@ require 'spec/rake/spectask'
3
3
 
4
4
  spec = Gem::Specification.new do |s|
5
5
  s.name = 'vuzitruby'
6
- s.version = "1.0.0"
6
+ s.version = "1.1.0"
7
7
  s.homepage = 'http://vuzit.com/'
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.authors = ["Brent Matzelle"]
10
10
  s.date = %q{2009-3-30}
11
+ s.default_executable = %q{vuzitcl}
12
+ s.executables = ["vuzitcl"]
11
13
  s.description = %q{This is a library for the Vuzit Web Services API. For
12
14
  more information on the platform, visit
13
15
  http://vuzit.com/developer}
@@ -20,7 +22,7 @@ spec = Gem::Specification.new do |s|
20
22
  #s.rdoc_options = ["--main", "README"]
21
23
  s.require_paths = ["lib"]
22
24
  s.rubyforge_project = %q{vuzitruby}
23
- s.rubygems_version = %q{1.0.0}
25
+ s.rubygems_version = %q{1.1.0}
24
26
  s.summary = %q{Ruby client library for the Vuzit Web Services API}
25
27
  s.extra_rdoc_files = ["README"]
26
28
  end
data/bin/vuzitcl ADDED
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'optparse'
4
+ require 'optparse/time'
5
+ require 'ostruct'
6
+ require 'pp'
7
+
8
+ require File.dirname(__FILE__) + '/../lib/vuzitruby'
9
+
10
+ class ParseOptions
11
+
12
+ # Parse the command line options.
13
+ def self.parse(args)
14
+ options = OpenStruct.new
15
+ options.key = nil
16
+ options.id = nil
17
+ options.upload = nil
18
+ options.public = false
19
+ options.delete = nil
20
+ options.load = nil
21
+ options.service_url = nil
22
+ options.verbose = false
23
+
24
+ opts = OptionParser.new do |opts|
25
+ opts.banner = "VuzitCL - Vuzit Command Line\n"
26
+ opts.banner += "Usage: vuzitcl -k [PUBLIC_KEY],[PRIVATE_KEY] [OPTIONS]"
27
+
28
+ opts.separator ""
29
+ opts.separator "Options:"
30
+
31
+ opts.on("-k", "--keys [PUB_KEY],[PRIV_KEY]",
32
+ "Developer API keys - REQUIRED") do |value|
33
+ options.key = value
34
+ end
35
+
36
+ opts.on("-u", "--upload [PATH]", "File to upload") do |value|
37
+ options.upload = value
38
+ end
39
+
40
+ opts.on("-p", "--public", "Make uploaded file public") do |value|
41
+ options.public = true
42
+ end
43
+
44
+ opts.on("-l", "--load [ID]", "Loads the document data") do |value|
45
+ options.load = value
46
+ end
47
+
48
+ opts.on("-d", "--delete [ID]", "Deletes a document") do |value|
49
+ options.delete = value
50
+ end
51
+
52
+ opts.on("-s", "--service-url [URL]", "Sets the service URL") do |value|
53
+ options.service_url = value
54
+ end
55
+
56
+ opts.on("-v", "--verbose", "Prints more messages") do
57
+ options.verbose = true
58
+ end
59
+
60
+ opts.on_tail("-h", "--help", "Show this message") do
61
+ puts opts
62
+ exit
63
+ end
64
+ end
65
+
66
+ if args.length < 1
67
+ puts opts
68
+ end
69
+
70
+ opts.parse!(args)
71
+ return options
72
+ end # parse()
73
+
74
+ end
75
+
76
+ def error(message)
77
+ puts ''
78
+ puts message
79
+ end
80
+
81
+ # Parse the options and run the program.
82
+ options = ParseOptions.parse(ARGV)
83
+
84
+ if options.key == nil
85
+ error "ERROR: Public and private keys are required"
86
+ exit
87
+ end
88
+
89
+ Vuzit::Service.public_key = options.key.split(',')[0]
90
+ Vuzit::Service.private_key = options.key.split(',')[1]
91
+
92
+ if options.service_url != nil
93
+ Vuzit::Service.service_url = options.service_url
94
+ end
95
+
96
+ if options.verbose == true
97
+ Vuzit::Service.debug = true
98
+ end
99
+
100
+ if options.load != nil
101
+ begin
102
+ doc = Vuzit::Document.find(options.load)
103
+ puts "LOADED: #{doc.id}"
104
+ puts "title: #{doc.title}"
105
+ puts "subject: #{doc.subject}"
106
+ puts "pages: #{doc.page_count}"
107
+ puts "width: #{doc.page_width}"
108
+ puts "height: #{doc.page_height}"
109
+ puts "size: #{doc.file_size}"
110
+ rescue Vuzit::Exception => ex
111
+ puts "Error occurred: #{ex.code}, #{ex.message}"
112
+ end
113
+ elsif options.delete != nil
114
+ begin
115
+ doc = Vuzit::Document.destroy(options.delete)
116
+ puts "DELETED: #{options.delete}"
117
+ rescue Vuzit::Exception => ex
118
+ error "Error occurred: #{ex.code}, #{ex.message}"
119
+ end
120
+ elsif options.upload != nil
121
+ begin
122
+ doc = Vuzit::Document.upload(options.upload, :secure => !options.public)
123
+ puts "UPLOADED: #{doc.id}"
124
+ rescue Vuzit::Exception => ex
125
+ error "Error occurred: #{ex.code}, #{ex.message}"
126
+ end
127
+ else
128
+ error "Please select an option"
129
+ end
130
+
@@ -5,6 +5,7 @@ require "mime/types" # Requires gem install mime-types
5
5
  require "base64"
6
6
  require 'cgi'
7
7
  require 'md5'
8
+ require 'digest/sha1' # required for rubyscript2exe
8
9
 
9
10
  module Net #:nodoc:all
10
11
  # Enhances the HTTP::Post class for multi-part post transactions
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: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brent Matzelle
@@ -10,13 +10,13 @@ bindir: bin
10
10
  cert_chain: []
11
11
 
12
12
  date: 2009-03-30 00:00:00 -04:00
13
- default_executable:
13
+ default_executable: vuzitcl
14
14
  dependencies: []
15
15
 
16
16
  description: This is a library for the Vuzit Web Services API. For more information on the platform, visit http://vuzit.com/developer
17
17
  email: support@vuzit.com
18
- executables: []
19
-
18
+ executables:
19
+ - vuzitcl
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files: