Class: Touchpass::Rp::Verification
- Inherits:
-
Object
- Object
- Touchpass::Rp::Verification
- Includes:
- HTTParty
- Defined in:
- lib/touchpass/rp/verification.rb
Instance Method Summary collapse
- #cancel(id) ⇒ Object
- #create(to_party, options = {}) ⇒ Object
-
#initialize ⇒ Verification
constructor
debug_output.
- #show(id) ⇒ Object
Constructor Details
#initialize ⇒ Verification
debug_output
7 8 9 |
# File 'lib/touchpass/rp/verification.rb', line 7 def initialize self.class.base_uri Touchpass.base_uri end |
Instance Method Details
#cancel(id) ⇒ Object
33 34 35 36 37 |
# File 'lib/touchpass/rp/verification.rb', line 33 def cancel(id) = { :body => {}, :headers => api_key_header } response = self.class.put("/verifications/#{id}/cancel.json", ) return Touchpass::Rp::Response.new(response) end |
#create(to_party, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/touchpass/rp/verification.rb', line 11 def create(to_party, ={}) = { :body => { :to_party => to_party }, :headers => api_key_header } # Defines which application will be used to handle the verification # (the default is to use the standalone app, or the first app registered) [:body][:to_app_id] = Touchpass.app_id if Touchpass.app_id # puts "Touchpass.app_id: #{Touchpass.app_id}" # Get the verifying party devices so we can encrypt message/prp using the devices public key device = Touchpass::Rp::Device.new vp_devices = device.get_all(to_party).response # TODO: vp_devices can be empty here, in which case verification creation will fail. # Create verification object verification = Touchpass::Verification.new(vp_devices, ) [:body].merge!(verification.http_params) response = self.class.post("/verifications.json", ) return Touchpass::Rp::Response.new(response) end |