Class: Incognia::Api
- Inherits:
-
Object
- Object
- Incognia::Api
- Defined in:
- lib/incognia_api/api.rb
Class Method Summary collapse
- .connection ⇒ Object
- .register_feedback(event:, occurred_at: nil, expires_at: nil, **ids) ⇒ Object
- .register_login(account_id:, request_token: nil, **opts) ⇒ Object
- .register_payment(account_id:, request_token: nil, **opts) ⇒ Object
-
.register_signup(request_token: nil, address: nil, **opts) ⇒ Object
business layer: uses the Client.instance to build domain objects raises missing parameters errors.
Class Method Details
.connection ⇒ Object
76 77 78 |
# File 'lib/incognia_api/api.rb', line 76 def connection Client.instance end |
.register_feedback(event:, occurred_at: nil, expires_at: nil, **ids) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/incognia_api/api.rb', line 43 def register_feedback(event:, occurred_at: nil, expires_at: nil, **ids) occurred_at = occurred_at.to_datetime.rfc3339 if occurred_at.respond_to? :to_datetime expires_at = expires_at.to_datetime.rfc3339 if expires_at.respond_to? :to_datetime params = { event: event, occurred_at: occurred_at, expires_at: expires_at }.compact params.merge!(ids) response = connection.request( :post, '/api/v2/feedbacks', params ) response.success? end |
.register_login(account_id:, request_token: nil, **opts) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/incognia_api/api.rb', line 26 def register_login(account_id:, request_token: nil, **opts) params = { type: :login, account_id: account_id, request_token: request_token }.compact params.merge!(opts) response = connection.request( :post, 'v2/authentication/transactions', params ) LoginAssessment.from_hash(response.body) if response.success? end |
.register_payment(account_id:, request_token: nil, **opts) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/incognia_api/api.rb', line 59 def register_payment(account_id:, request_token: nil, **opts) params = { type: :payment, account_id: account_id, request_token: request_token }.compact params.merge!(opts) response = connection.request( :post, 'v2/authentication/transactions', params ) PaymentAssessment.from_hash(response.body) if response.success? end |
.register_signup(request_token: nil, address: nil, **opts) ⇒ Object
business layer: uses the Client.instance to build domain objects raises missing parameters errors
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/incognia_api/api.rb', line 12 def register_signup(request_token: nil, address: nil, **opts) params = { request_token: request_token }.compact params.merge!(opts) params.merge!(address&.to_hash) if address response = connection.request( :post, 'v2/onboarding/signups', params ) SignupAssessment.from_hash(response.body) if response.success? end |