lib/incognia/api.rb in incognia_api-0.2.0 vs lib/incognia/api.rb in incognia_api-0.3.0

- old
+ new

@@ -34,8 +34,39 @@ "v2/onboarding/signups/#{signup_id}" ) SignupAssessment.from_hash(response.body) if response.success? end - end + def register_login(installation_id:, account_id:, **opts) + params = { + type: :login, + installation_id: installation_id, + account_id: account_id, + } + params.merge!(opts) + + response = connection.request( + :post, + 'v2/authentication/transactions', + params + ) + + LoginAssessment.from_hash(response.body) if response.success? + end + + def register_feedback(event: , timestamp: nil, **ids) + timestamp = timestamp.strftime('%s%L') if timestamp.respond_to? :strftime + + params = { event: event, timestamp: timestamp&.to_i }.compact + params.merge!(ids) + + response = connection.request( + :post, + '/api/v2/feedbacks', + params + ) + + response.success? + end + end end