Class: Spriv::Poller

Inherits:
Object
  • Object
show all
Defined in:
lib/spriv/poller.rb

Constant Summary collapse

AZURE_URI =
'https://sprivservices.azurewebsites.net/api/v2/Poller/GetDecision'

Instance Method Summary collapse

Instance Method Details

#get_decision(id) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/spriv/poller.rb', line 8

def get_decision(id)
  begin
    uri = URI.parse(AZURE_URI)
    params = {
      key: ::Spriv.config.username,
      secret: ::Spriv.config.password,
      transactionID: id
    }
    uri.query = URI.encode_www_form(params)
    response = Net::HTTP.get(uri)
    JSON.parse(response)
  rescue Exception => e
    { message: e.message }
  end
end