finapps 6.1.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 287e012502599f7781e37f492a27d67c956fa2f4d94073163302f3c429da4d42
4
- data.tar.gz: f7da81b6008ac880f6d028c3dc209945e65641f979d5c9d3d98580ab3deb7713
3
+ metadata.gz: 2f72a781755bf6469c544e60b5ae9fdf11edb57efe6dd947594c8c03e5d6204b
4
+ data.tar.gz: 06df03914644a7b4eea4a5a3478d12959b4470f30ed1c31adbe4beed7b83dcb3
5
5
  SHA512:
6
- metadata.gz: f87c89de3b7915c3ecc54300cc31060b3ce39da36c860e4a539832e302e1576a560c31247925351a0eb798e32563a65f2358d265760c3078940e1f4e7c2aa88d
7
- data.tar.gz: 6a8ac80500a6f696817efff46e1fd39a79feb6823ae4ab9693a2b588166bcf175ebcdede16d491b4410fd015d0e4519d45e81acc98e2f9f8b7adfbd85f63193f
6
+ metadata.gz: 27109c39e9a476272df05507d7ab97b017add220878422120279708c70db385dd82bc0fe65d6c92521e3e640f9bcde905810893cf0c88fec452b9cd2d51782ae
7
+ data.tar.gz: f02bc2aa43038d59036b43b312e81b9ef865082c28130c0b34745d4e7d2a84175fc4f00b0528433579334e906cfceb5409288bb0aa068fdc0eb4e033a1ee3f80
data/lib/finapps.rb CHANGED
@@ -6,6 +6,7 @@ require 'faraday_middleware'
6
6
  require 'finapps_core'
7
7
  require 'finapps/rest/version'
8
8
  require 'finapps/rest/consumers'
9
+ require 'finapps/rest/consumer_login_tokens'
9
10
  require 'finapps/rest/sessions'
10
11
  require 'finapps/rest/order_tokens'
11
12
  require 'finapps/rest/orders'
@@ -10,6 +10,7 @@ module FinApps
10
10
  alert_definitions
11
11
  alert_occurrences
12
12
  consumers
13
+ consumer_login_tokens
13
14
  consumers_portfolios
14
15
  documents_orders
15
16
  documents_orders_notifications
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ class ConsumerLoginTokens < FinAppsCore::REST::Resources
6
+ def create(params)
7
+ not_blank(params, :params)
8
+ super params, 'login/token'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '6.1.0'
4
+ VERSION = '6.2.0'
5
5
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helpers/client'
4
+
5
+ RSpec.describe FinApps::REST::ConsumerLoginTokens do
6
+ context 'when initialized with valid FinApps::Client object' do
7
+ include SpecHelpers::Client
8
+ subject(:consumer_login_tokens) { described_class.new(client) }
9
+
10
+ describe '#create' do
11
+ let(:results) { create[0] }
12
+ let(:error_messages) { create[1] }
13
+
14
+ context 'when missing params' do
15
+ let(:create) { consumer_login_tokens.create(nil) }
16
+
17
+ error = FinAppsCore::MissingArgumentsError
18
+ it { expect { create }.to raise_error(error) }
19
+ end
20
+
21
+ context 'when invalid params are provided' do
22
+ let(:create) { consumer_login_tokens.create(params: 'invalid') }
23
+
24
+ it { expect { create }.not_to raise_error }
25
+ it('results is nil') { expect(results).to be_nil }
26
+
27
+ it('error messages array is populated') do
28
+ expect(error_messages.first.downcase).to eq('invalid request body')
29
+ end
30
+ end
31
+
32
+ context 'when valid params are provided' do
33
+ let(:create) { consumer_login_tokens.create(params: 'valid') }
34
+
35
+ it { expect { create }.not_to raise_error }
36
+ it('returns an array') { expect(create).to be_a(Array) }
37
+ it { expect(results).to have_key(:public_id) }
38
+ it { expect(results).to have_key(:external_id) }
39
+ it { expect(results).to have_key(:tenant_id) }
40
+ it { expect(results).to have_key(:role) }
41
+ it { expect(results).to have_key(:memo) }
42
+ it { expect(results).to have_key(:token) }
43
+ it('returns no error messages') { expect(error_messages).to be_empty }
44
+ end
45
+ end
46
+ end
47
+ end
@@ -359,7 +359,7 @@ module Fake
359
359
  end
360
360
 
361
361
  # operators login tokens
362
- post("/#{version}/login/operators/token") do
362
+ post("/#{version}/login/token") do
363
363
  request.body.rewind
364
364
  request_payload = JSON.parse request.body.read
365
365
  if request_payload['params'] == 'valid'
@@ -369,6 +369,17 @@ module Fake
369
369
  end
370
370
  end
371
371
 
372
+ # operators login tokens
373
+ post("/#{version}/login/operators/token") do
374
+ request.body.rewind
375
+ request_payload = JSON.parse request.body.read
376
+ if request_payload['params'] == 'valid'
377
+ json_response 200, 'consumer_login_token.json'
378
+ else
379
+ json_response 400, 'invalid_request_body.json'
380
+ end
381
+ end
382
+
372
383
  # session
373
384
  post("/#{version}/login") do
374
385
  request.body.rewind
@@ -0,0 +1,23 @@
1
+ {
2
+ "auth0_id": "string",
3
+ "date_created": "2021-07-19T13:04:09Z",
4
+ "date_modified": "2021-07-19T13:04:09Z",
5
+ "email": "string",
6
+ "external_id": "string",
7
+ "first_name": "string",
8
+ "last_name": "string",
9
+ "locked": true,
10
+ "memo": "string",
11
+ "metadata": {
12
+ "property1": { },
13
+ "property2": { }
14
+ },
15
+ "phone": "string",
16
+ "phone_country_code": "string",
17
+ "postal_code": "string",
18
+ "public_id": "string",
19
+ "role": 0,
20
+ "status": 0,
21
+ "tenant_id": "string",
22
+ "token": "string"
23
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finapps
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-16 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: finapps_core
@@ -261,6 +261,7 @@ files:
261
261
  - lib/finapps/rest/alert_definitions.rb
262
262
  - lib/finapps/rest/alert_occurrences.rb
263
263
  - lib/finapps/rest/client.rb
264
+ - lib/finapps/rest/consumer_login_tokens.rb
264
265
  - lib/finapps/rest/consumers.rb
265
266
  - lib/finapps/rest/consumers_portfolios.rb
266
267
  - lib/finapps/rest/documents_orders.rb
@@ -307,6 +308,7 @@ files:
307
308
  - spec/rest/alert_occurrences_spec.rb
308
309
  - spec/rest/api_request.rb
309
310
  - spec/rest/client_spec.rb
311
+ - spec/rest/consumer_login_tokens_spec.rb
310
312
  - spec/rest/consumers_portfolios_spec.rb
311
313
  - spec/rest/consumers_spec.rb
312
314
  - spec/rest/documents_orders_notifications_spec.rb
@@ -353,6 +355,7 @@ files:
353
355
  - spec/support/fixtures/alert_definition.json
354
356
  - spec/support/fixtures/alert_definitions.json
355
357
  - spec/support/fixtures/alert_occurrences.json
358
+ - spec/support/fixtures/consumer_login_token.json
356
359
  - spec/support/fixtures/documents/retrieve_order.json
357
360
  - spec/support/fixtures/documents_order.json
358
361
  - spec/support/fixtures/documents_orders.json
@@ -503,3 +506,4 @@ test_files:
503
506
  - spec/rest/operators_spec.rb
504
507
  - spec/rest/password_resets_spec.rb
505
508
  - spec/rest/portfolios_available_consumers_spec.rb
509
+ - spec/rest/consumer_login_tokens_spec.rb