touchpass 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- touchpass (0.1.0)
4
+ touchpass (0.1.3)
5
5
  geocoder (~> 1.1.0)
6
6
  httparty (~> 0.8.0)
7
7
  json (~> 1.6.5)
@@ -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.to_h)
289
+ puts JSON.pretty_generate(response)
274
290
  end
275
291
  end
276
292
 
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Touchpass
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-22 00:00:00.000000000 Z
12
+ date: 2012-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty