touchpass 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/bin/touchpass +17 -1
- data/lib/touchpass/client.rb +13 -1
- data/lib/touchpass/version.rb +1 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/bin/touchpass
CHANGED
@@ -246,6 +246,20 @@ class TpCLI < Thor
|
|
246
246
|
output @touchpass_client.reject_verification(options[:id], options[:device_id],options)
|
247
247
|
end
|
248
248
|
|
249
|
+
desc "provision_party", "Provision a new Party"
|
250
|
+
method_option :api_key, :required => true, :default => DFT_API_KEY
|
251
|
+
method_option :username, :aliases => "-u"
|
252
|
+
method_option :email, :aliases => "-e"
|
253
|
+
method_option :app_id, :aliases => '-a', :required => true
|
254
|
+
method_option :hostname, :aliases => "-h"
|
255
|
+
method_option :output, :aliases => "-o"
|
256
|
+
method_option :debug, :aliases => "-d", :type => :boolean
|
257
|
+
def provision_party
|
258
|
+
setup(options)
|
259
|
+
output @touchpass_client.provision_party(options[:username], options[:email],
|
260
|
+
options[:app_id], options)
|
261
|
+
end
|
262
|
+
|
249
263
|
private
|
250
264
|
|
251
265
|
# Construct a Touchpass:Client instance
|
@@ -266,11 +280,13 @@ class TpCLI < Thor
|
|
266
280
|
end
|
267
281
|
|
268
282
|
def output(response)
|
283
|
+
response = response.kind_of?(Hash) ? response : response.to_h
|
284
|
+
|
269
285
|
case @output
|
270
286
|
when :xml
|
271
287
|
puts XmlSimple.xml_out(response, 'NoAttr' => true, 'RootName' => 'response')
|
272
288
|
when :json
|
273
|
-
puts JSON.pretty_generate(response
|
289
|
+
puts JSON.pretty_generate(response)
|
274
290
|
end
|
275
291
|
end
|
276
292
|
|
data/lib/touchpass/client.rb
CHANGED
@@ -355,7 +355,19 @@ module Touchpass
|
|
355
355
|
url = "#{@hostname}/verifications/#{verification_id}/reject"
|
356
356
|
submit_request("put", url, http_options)
|
357
357
|
end
|
358
|
-
|
358
|
+
|
359
|
+
def provision_party(username, email, app_id, options = {})
|
360
|
+
require_api_key
|
361
|
+
require_param(username, "username")
|
362
|
+
require_param(email, "email")
|
363
|
+
require_param(app_id, "application id")
|
364
|
+
|
365
|
+
options = options.merge(:username => username, :email => email, :app_id => app_id)
|
366
|
+
http_options = standard_http_options(options, %W{username email app_id mobile_number})
|
367
|
+
url = "#{@hostname}/admin/configurations"
|
368
|
+
response = submit_request("post", url, http_options)
|
369
|
+
end
|
370
|
+
|
359
371
|
private
|
360
372
|
|
361
373
|
def party_url_id(party_id)
|
data/lib/touchpass/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: touchpass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|