vws 1.0.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.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.travis.yml +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +109 -0
- data/Rakefile +2 -0
- data/lib/vws.rb +226 -0
- data/lib/vws/version.rb +3 -0
- data/spec/Grayscale_8bits.png +0 -0
- data/spec/RGB_24bits.jpg +0 -0
- data/spec/cumbria_woodland02859.jpg +0 -0
- data/spec/pitt.jpg +0 -0
- data/spec/vws_spec.rb +96 -0
- data/vws.gemspec +31 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 58eb6f203dce595126186721e7b0f4c01861c94a
|
4
|
+
data.tar.gz: 529be7ff94d498b9c0b48c9d7fc535ac87c6d095
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9c692434c73fe0f300ef8c7bff52f0980e7c8c15accd72eb0ac037e940fbe2bb3588a1b3508e11c098e4a165fa631567488784e7c1d8ebceb72df45f1bd3053a
|
7
|
+
data.tar.gz: 383e15757243fa5f5529d76b02b2ea4c829f6f0e4faffcfa2e8c1c045086a89ab30acb5acc0eae395aa4c135a2a358761e65bbc2a1ae6ba57b0bfd6bba83092e
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Nikos Kokkos
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# Vws (Vuforia Web Services ruby gem for API access)
|
2
|
+
|
3
|
+
This is a ruby gem to interact with Vuforia web services api for managing the targets:
|
4
|
+
https://developer.vuforia.com/resources/dev-guide/managing-targets-cloud-database-using-developer-api
|
5
|
+
|
6
|
+
It uses the excellent rest-client (https://github.com/rest-client/rest-client) to handle the
|
7
|
+
HTTP/REST requests required by the Vuforia Web Services API.
|
8
|
+
|
9
|
+
## Installation from source
|
10
|
+
|
11
|
+
|
12
|
+
Clone this repo onto your hard drive and cd into the root folder.
|
13
|
+
|
14
|
+
|
15
|
+
First install bundler gem (if it is not installed) by issuing:
|
16
|
+
|
17
|
+
gem install bundler
|
18
|
+
|
19
|
+
Install the required gems by vws gem by:
|
20
|
+
|
21
|
+
bundle install
|
22
|
+
|
23
|
+
Build the vws gem by:
|
24
|
+
|
25
|
+
rake build
|
26
|
+
|
27
|
+
This will build the vws.gem into the pkg folder.
|
28
|
+
|
29
|
+
|
30
|
+
Install the gem from the pkg folder by:
|
31
|
+
|
32
|
+
gem install vws.gem
|
33
|
+
|
34
|
+
|
35
|
+
## Basic Installation using rails Gemfile:
|
36
|
+
|
37
|
+
|
38
|
+
Add this line to your rails application's Gemfile:
|
39
|
+
|
40
|
+
gem 'vws'
|
41
|
+
|
42
|
+
And then execute:
|
43
|
+
|
44
|
+
bundle install
|
45
|
+
|
46
|
+
This should work if you have installed the gem from source. I have not
|
47
|
+
uploaded the gem to rubygems.org yet
|
48
|
+
|
49
|
+
|
50
|
+
## Usage
|
51
|
+
|
52
|
+
Instantiate a connection to the api with:
|
53
|
+
|
54
|
+
connection = Vws::Api.new("your_server_vws_access_key", "your_server_vws_secret_key")
|
55
|
+
|
56
|
+
After a successful connection, you should have access to the vuforia api as shown here:
|
57
|
+
https://developer.vuforia.com/resources/dev-guide/managing-targets-cloud-database-using-developer-api
|
58
|
+
|
59
|
+
So, if you want to get a summary of the cloud database, you issue:
|
60
|
+
|
61
|
+
connection.summary
|
62
|
+
|
63
|
+
For a list of targets in your database:
|
64
|
+
|
65
|
+
connection.list_targets
|
66
|
+
|
67
|
+
To retrieve a target's info:
|
68
|
+
|
69
|
+
connection.retrieve_target(target_id)
|
70
|
+
|
71
|
+
To activate or deactivate a target:
|
72
|
+
|
73
|
+
connection.set_active_flag(target_id, active_flag) where active_flag = true/false
|
74
|
+
|
75
|
+
To add a target to the database:
|
76
|
+
|
77
|
+
connection.add_target(target_name, file_path, width, active_flag)
|
78
|
+
|
79
|
+
To delete a target:
|
80
|
+
|
81
|
+
connection.delete_target(target_id)
|
82
|
+
|
83
|
+
but before deleting a target, you have to set to inactive if it active and
|
84
|
+
wait for a while:
|
85
|
+
|
86
|
+
Change a target flag to inactive/active:
|
87
|
+
|
88
|
+
connection.set_active_flag(target_id, active_flag), where active_flag=true/false
|
89
|
+
|
90
|
+
|
91
|
+
## Spec
|
92
|
+
|
93
|
+
Enter your server keys into vws_spec.rb file and run the specs at the root
|
94
|
+
of the folder by issuing:
|
95
|
+
|
96
|
+
rspec spec
|
97
|
+
|
98
|
+
## To do:
|
99
|
+
|
100
|
+
Implement some of the new vws apis and write better documentation :-)
|
101
|
+
|
102
|
+
|
103
|
+
## Contributing
|
104
|
+
|
105
|
+
1. Fork it
|
106
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
107
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
108
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
109
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/vws.rb
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
require "vws/version"
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rest_client'
|
4
|
+
require 'digest/md5'
|
5
|
+
require 'time'
|
6
|
+
require 'openssl'
|
7
|
+
require 'base64'
|
8
|
+
require 'json'
|
9
|
+
|
10
|
+
|
11
|
+
module Vws
|
12
|
+
#constants for end point interface links
|
13
|
+
BASE_URL = "https://vws.vuforia.com"
|
14
|
+
TARGETS_URL = BASE_URL + "/targets"
|
15
|
+
SUMMARY_URL = BASE_URL + "/summary"
|
16
|
+
|
17
|
+
class Api
|
18
|
+
|
19
|
+
def initialize(accesskey=nil, secretkey=nil)
|
20
|
+
@accesskey = accesskey || ENV['VWS_ACCESSKEY']
|
21
|
+
@secretkey = secretkey || ENV['VWS_SECRETKEY']
|
22
|
+
end
|
23
|
+
|
24
|
+
def build_signature(request_path, body_hash, http_verb, timestamp)
|
25
|
+
# request_path signifies the suburi you call after you subtract the
|
26
|
+
# BASE_URL; that is, if you call https://vws/vuforia.com/targets,
|
27
|
+
# the request_path is '/targets'
|
28
|
+
|
29
|
+
contentType = ""
|
30
|
+
hexDigest = "d41d8cd98f00b204e9800998ecf8427e" # Hex digest of an empty
|
31
|
+
# string. We use it to
|
32
|
+
# signify empty body
|
33
|
+
|
34
|
+
if http_verb == "GET" || http_verb == "DELETE"
|
35
|
+
# Do nothing since we have already set contentType and hexDigest
|
36
|
+
elsif http_verb == "POST" || http_verb == "PUT"
|
37
|
+
contentType = "application/json";
|
38
|
+
# the request should have a request body, so create an md5 hash of that
|
39
|
+
# json body data
|
40
|
+
hexDigest = Digest::MD5.hexdigest(body_hash.to_json)
|
41
|
+
else
|
42
|
+
puts "Invalid request method";
|
43
|
+
return nil
|
44
|
+
end
|
45
|
+
|
46
|
+
toDigest = http_verb + "\n" +
|
47
|
+
hexDigest + "\n" +
|
48
|
+
contentType + "\n" +
|
49
|
+
timestamp + "\n" +
|
50
|
+
request_path
|
51
|
+
|
52
|
+
return Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new,
|
53
|
+
@secretkey, toDigest))
|
54
|
+
end
|
55
|
+
|
56
|
+
# Calls the api end point for the list of targets associated with
|
57
|
+
# server access key and cloud database
|
58
|
+
def list_targets
|
59
|
+
#Date is the current date per RFC 2616, section 3.3.1,
|
60
|
+
#rfc1123-date format, e.g.: Sun, 22 Apr #2012 08:49:37 GMT.
|
61
|
+
date_timestamp = Time.now.httpdate #ruby provides this date format
|
62
|
+
#with httpdate method
|
63
|
+
signature = self.build_signature('/targets', nil, 'GET', date_timestamp)
|
64
|
+
authorization_header = "VWS " + @accesskey + ":" + signature
|
65
|
+
begin
|
66
|
+
RestClient.get(TARGETS_URL, :'Date' => date_timestamp,
|
67
|
+
:'Authorization' => authorization_header)
|
68
|
+
rescue => e
|
69
|
+
e.response
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def add_target(target_name, file_path, width, active_flag)
|
74
|
+
date_timestamp = Time.now.httpdate
|
75
|
+
#for file uploads, read file contents data and Base 64 encode it:
|
76
|
+
contents_encoded = Base64.encode64(File.open(file_path, 'rb').read)
|
77
|
+
body_hash = { :name => target_name,
|
78
|
+
:width => width, #width of the target in scene units
|
79
|
+
:image => contents_encoded,
|
80
|
+
:active_flag => active_flag }
|
81
|
+
signature = self.build_signature('/targets', body_hash, 'POST', date_timestamp)
|
82
|
+
authorization_header = "VWS " + @accesskey + ":" + signature
|
83
|
+
begin
|
84
|
+
RestClient.post(TARGETS_URL, body_hash.to_json,
|
85
|
+
:'Date' => date_timestamp,
|
86
|
+
:'Authorization' => authorization_header,
|
87
|
+
:content_type => 'application/json',
|
88
|
+
:accept => :json)
|
89
|
+
rescue => e
|
90
|
+
e.response
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def update_target(target_id, target_name=nil, file_path=nil, width=nil, active_flag=nil)
|
95
|
+
date_timestamp = Time.now.httpdate
|
96
|
+
target_id_url = TARGETS_URL + '/' + target_id
|
97
|
+
target_id_suburl = '/targets' + '/' + target_id
|
98
|
+
#for file uploads, read file contents data and Base 64 encode it:
|
99
|
+
contents_encoded = Base64.encode64(File.open(file_path, 'rb').read)
|
100
|
+
body_hash = { :name => target_name,
|
101
|
+
:width => width, #Width of the target in scene unit
|
102
|
+
:image => contents_encoded,
|
103
|
+
:active_flag => active_flag }
|
104
|
+
signature = self.build_signature(target_id_suburl, body_hash, 'PUT', date_timestamp)
|
105
|
+
authorization_header = "VWS " + @accesskey + ":" + signature
|
106
|
+
begin
|
107
|
+
RestClient.put(target_id_url, body_hash.to_json,
|
108
|
+
:'Date' => date_timestamp,
|
109
|
+
:'Authorization' => authorization_header,
|
110
|
+
:content_type => 'application/json',
|
111
|
+
:accept => :json)
|
112
|
+
rescue => e
|
113
|
+
e.response
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Database Summary Report
|
118
|
+
# https://developer.vuforia.com/resources/dev-guide/database-summary-report
|
119
|
+
def summary
|
120
|
+
date_timestamp = Time.now.httpdate
|
121
|
+
signature = self.build_signature('/summary', nil, 'GET', date_timestamp)
|
122
|
+
authorization_header = "VWS " + @accesskey + ":" + signature
|
123
|
+
begin
|
124
|
+
RestClient.get(SUMMARY_URL, :'Date' => date_timestamp,
|
125
|
+
:'Authorization' => authorization_header)
|
126
|
+
rescue => e
|
127
|
+
e.response
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# Retrieve a target from the cloud database
|
132
|
+
# https://developer.vuforia.com/resources/dev-guide/retrieving-target-cloud-database
|
133
|
+
def retrieve_target(target_id)
|
134
|
+
date_timestamp = Time.now.httpdate
|
135
|
+
target_id_url = TARGETS_URL + '/' + target_id
|
136
|
+
target_id_suburl = '/targets' + '/' + target_id
|
137
|
+
signature = self.build_signature(target_id_suburl, nil, 'GET', date_timestamp)
|
138
|
+
authorization_header = "VWS " + @accesskey + ":" + signature
|
139
|
+
begin
|
140
|
+
RestClient.get(target_id_url, :'Date' => date_timestamp,
|
141
|
+
:'Authorization' => authorization_header)
|
142
|
+
rescue => e
|
143
|
+
e.response
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Target Summary Report
|
148
|
+
# https://developer.vuforia.com/resources/dev-guide/target-summary-report
|
149
|
+
def target_summary(target_id)
|
150
|
+
date_timestamp = Time.now.httpdate
|
151
|
+
target_id_url = SUMMARY_URL + '/' + target_id
|
152
|
+
target_id_suburl = '/summary' + '/' + target_id
|
153
|
+
signature = self.build_signature(target_id_suburl, nil, 'GET', date_timestamp)
|
154
|
+
authorization_header = "VWS " + @accesskey + ":" + signature
|
155
|
+
begin
|
156
|
+
RestClient.get(target_id_url, :'Date' => date_timestamp,
|
157
|
+
:'Authorization' => authorization_header)
|
158
|
+
rescue => e
|
159
|
+
e.response
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def set_active_flag(target_id, active_flag)
|
164
|
+
date_timestamp = Time.now.httpdate
|
165
|
+
target_id_url = TARGETS_URL + '/' + target_id
|
166
|
+
target_id_suburl = '/targets' + '/' + target_id
|
167
|
+
body_hash = {:active_flag => active_flag}
|
168
|
+
signature = self.build_signature(target_id_suburl, body_hash, 'PUT', date_timestamp)
|
169
|
+
authorization_header = "VWS " + @accesskey + ":" + signature
|
170
|
+
|
171
|
+
begin
|
172
|
+
RestClient.put(target_id_url, body_hash.to_json,
|
173
|
+
:'Date' => date_timestamp,
|
174
|
+
:'Authorization' => authorization_header,
|
175
|
+
:content_type => 'application/json',
|
176
|
+
:accept => :json)
|
177
|
+
rescue => e
|
178
|
+
e.response
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Delete a target in a cloud database
|
183
|
+
# https://developer.vuforia.com/resources/dev-guide/deleting-target-cloud-database
|
184
|
+
def delete_target(target_id)
|
185
|
+
# In order to delete the target, we have to set it to non-active.
|
186
|
+
# Therefore,first retrieve target info and act accordingly to target info
|
187
|
+
# returned
|
188
|
+
target_data = JSON.parse(retrieve_target(target_id)) # have to JSON.parse
|
189
|
+
# retrieve_target's results since they're in string format
|
190
|
+
target_result_code = target_data["result_code"]
|
191
|
+
if target_result_code != "AuthenticationFailure"
|
192
|
+
if target_result_code != "UnknownTarget"
|
193
|
+
target_active_flag = target_data["target_record"]["active_flag"]
|
194
|
+
target_status = target_data["status"]
|
195
|
+
if target_result_code == "Success"
|
196
|
+
if target_active_flag == true && target_status == "success"
|
197
|
+
return {:result_code => "TargetActive"}.to_json
|
198
|
+
elsif target_active_flag == false && target_status == "success"
|
199
|
+
# if we reached this point, the target is fine, inactive and
|
200
|
+
# ready to be deleted
|
201
|
+
date_timestamp = Time.now.httpdate
|
202
|
+
target_id_url = TARGETS_URL + '/' + target_id
|
203
|
+
target_id_suburl = '/targets' + '/' + target_id
|
204
|
+
signature = self.build_signature(target_id_suburl, nil, 'DELETE', date_timestamp)
|
205
|
+
authorization_header = "VWS " + @accesskey + ":" + signature
|
206
|
+
begin
|
207
|
+
RestClient.delete(target_id_url,
|
208
|
+
:'Date' => date_timestamp,
|
209
|
+
:'Authorization' => authorization_header)
|
210
|
+
rescue => e
|
211
|
+
e.response
|
212
|
+
end
|
213
|
+
else
|
214
|
+
return {:result_code => "#{target_status}"}.to_json
|
215
|
+
end
|
216
|
+
end
|
217
|
+
else
|
218
|
+
return {:result_code => "UnknownTarget"}.to_json
|
219
|
+
end
|
220
|
+
else
|
221
|
+
return {:result_code => "AuthenticationFailure"}.to_json
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
226
|
+
end
|
data/lib/vws/version.rb
ADDED
Binary file
|
data/spec/RGB_24bits.jpg
ADDED
Binary file
|
Binary file
|
data/spec/pitt.jpg
ADDED
Binary file
|
data/spec/vws_spec.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
require_relative '../lib/vws.rb'
|
2
|
+
|
3
|
+
describe Vws do
|
4
|
+
|
5
|
+
VWS_ACCESSKEY = "your_vws_server_database_access_key"
|
6
|
+
VWS_SECRETKEY = "your_vws_server_database_secret_key"
|
7
|
+
|
8
|
+
|
9
|
+
#code below between begin and end was an attempt to read env variables from file
|
10
|
+
=begin
|
11
|
+
describe "should connect to webservice and fail otherwise" do
|
12
|
+
YAML.load(File.open('spec/local_env.yml')).each do |key, value|
|
13
|
+
ENV[key.to_s] = value
|
14
|
+
end if File.exists?('spec/local_env.yml')
|
15
|
+
if defined?(ENV['VWS_ACCESSKEY']) && defined?(ENV['VWS_SECRETKEY'])
|
16
|
+
conn = Vws::Api.new(ENV['VWS_ACCESSKEY'], ENV['VWS_SECRETKEY'])
|
17
|
+
conn.inspect
|
18
|
+
#puts conn.list_targets
|
19
|
+
else
|
20
|
+
puts "ENV['VWS_ACCESSKEY'] && ENV['VWS_SECRETKEY' not defined"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
=end
|
24
|
+
|
25
|
+
describe "should connect to webservice and show summary of the cloud database" do
|
26
|
+
conn = Vws::Api.new(VWS_ACCESSKEY, VWS_SECRETKEY)
|
27
|
+
puts "Summary of the target database: \n"
|
28
|
+
response = conn.summary
|
29
|
+
puts JSON.pretty_generate(JSON.parse(response))
|
30
|
+
end
|
31
|
+
|
32
|
+
puts "\n"
|
33
|
+
|
34
|
+
describe "should connect to webservice and list all targets" do
|
35
|
+
conn = Vws::Api.new(VWS_ACCESSKEY, VWS_SECRETKEY)
|
36
|
+
puts "Targets in remote database: \n"
|
37
|
+
response = conn.list_targets
|
38
|
+
puts JSON.pretty_generate(JSON.parse(response))
|
39
|
+
end
|
40
|
+
|
41
|
+
puts "\n"
|
42
|
+
|
43
|
+
describe "should connect to webservice, upload file and fail if the file name is the same" do
|
44
|
+
conn = Vws::Api.new(VWS_ACCESSKEY, VWS_SECRETKEY)
|
45
|
+
puts "Response after trying to add a file: \n"
|
46
|
+
response = conn.add_target("newtargetname", "spec/RGB_24bits.jpg", 150, true)
|
47
|
+
puts JSON.pretty_generate(JSON.parse(response))
|
48
|
+
end
|
49
|
+
|
50
|
+
puts "\n"
|
51
|
+
|
52
|
+
describe "should retrieve a single target info" do
|
53
|
+
conn = Vws::Api.new(VWS_ACCESSKEY, VWS_SECRETKEY)
|
54
|
+
puts "Info for targetid = ee408e0b9d054a04b0df85e0642494d2 \n"
|
55
|
+
response = conn.retrieve_target("ee408e0b9d054a04b0df85e0642494d2")
|
56
|
+
puts JSON.pretty_generate(JSON.parse(response))
|
57
|
+
end
|
58
|
+
|
59
|
+
puts "\n"
|
60
|
+
|
61
|
+
describe "should retrieve a summary report of a single target" do
|
62
|
+
conn = Vws::Api.new(VWS_ACCESSKEY, VWS_SECRETKEY)
|
63
|
+
puts "Summary report targetid = 4098a76b155a4bfc9331f9ea4e858636 \n"
|
64
|
+
response = conn.target_summary("4098a76b155a4bfc9331f9ea4e858636")
|
65
|
+
puts JSON.pretty_generate(JSON.parse(response))
|
66
|
+
end
|
67
|
+
|
68
|
+
puts '/n'
|
69
|
+
|
70
|
+
describe "delete target" do
|
71
|
+
conn = Vws::Api.new(VWS_ACCESSKEY, VWS_SECRETKEY)
|
72
|
+
puts "What happens if try to delete a file with targetid = 4098a76b155a4bfc9331f9ea4e858636 ?: \n"
|
73
|
+
response = conn.delete_target("4098a76b155a4bfc9331f9ea4e8536")
|
74
|
+
puts JSON.pretty_generate(JSON.parse(response))
|
75
|
+
end
|
76
|
+
|
77
|
+
puts "\n"
|
78
|
+
|
79
|
+
describe "set active to false" do
|
80
|
+
conn = Vws::Api.new(VWS_ACCESSKEY, VWS_SECRETKEY)
|
81
|
+
puts "Set target to false for targetid = ee408e0b9d054a04b0df85e0642494d2 \n"
|
82
|
+
response = conn.set_active_flag("ee408e0b9d054a04b0df85e0642494d2", false)
|
83
|
+
puts JSON.pretty_generate(JSON.parse(response))
|
84
|
+
end
|
85
|
+
|
86
|
+
puts "\n"
|
87
|
+
|
88
|
+
describe "should connect to webservice, upload Pitt picture and fail if the file name is the same" do
|
89
|
+
conn = Vws::Api.new(VWS_ACCESSKEY, VWS_SECRETKEY)
|
90
|
+
puts "Add Brat Pitt Picture: \n"
|
91
|
+
response = conn.add_target("pitt", "spec/pitt.jpg", 210, true)
|
92
|
+
puts JSON.pretty_generate(JSON.parse(response))
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
data/vws.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vws/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vws"
|
8
|
+
spec.version = Vws::VERSION
|
9
|
+
spec.authors = ["Nick Kokkos"]
|
10
|
+
spec.email = ["nkokkos@gmail.com"]
|
11
|
+
spec.description = %q{Vuforia web services api gem}
|
12
|
+
spec.summary = %q{This is a ruby gem that interacts with Vuforia Web service API for Cloud database management. It uses the rest-client gem to handle the http/rest requests needed}
|
13
|
+
spec.homepage = "http://github.com/nkokkos/vws"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
|
22
|
+
#development depedencies
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.1"
|
25
|
+
spec.add_development_dependency "rspec","~> 2.14"
|
26
|
+
#spec.add_development_dependency "json","~> 1.8"
|
27
|
+
|
28
|
+
#runtime dependencies
|
29
|
+
spec.add_runtime_dependency "rest-client", "~> 1.6"
|
30
|
+
spec.add_runtime_dependency "json", "~> 1.8"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vws
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Kokkos
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.8'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.8'
|
83
|
+
description: Vuforia web services api gem
|
84
|
+
email:
|
85
|
+
- nkokkos@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- lib/vws.rb
|
97
|
+
- lib/vws/version.rb
|
98
|
+
- spec/Grayscale_8bits.png
|
99
|
+
- spec/RGB_24bits.jpg
|
100
|
+
- spec/cumbria_woodland02859.jpg
|
101
|
+
- spec/pitt.jpg
|
102
|
+
- spec/vws_spec.rb
|
103
|
+
- vws.gemspec
|
104
|
+
homepage: http://github.com/nkokkos/vws
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.2.1
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: This is a ruby gem that interacts with Vuforia Web service API for Cloud
|
128
|
+
database management. It uses the rest-client gem to handle the http/rest requests
|
129
|
+
needed
|
130
|
+
test_files:
|
131
|
+
- spec/Grayscale_8bits.png
|
132
|
+
- spec/RGB_24bits.jpg
|
133
|
+
- spec/cumbria_woodland02859.jpg
|
134
|
+
- spec/pitt.jpg
|
135
|
+
- spec/vws_spec.rb
|