finapps 2.3.5 → 2.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 466bc237a6a77b4f9021545c74a398c3665a18b3
4
- data.tar.gz: 42e49b85f895de09e7892a59e0aad5320ffcd63c
3
+ metadata.gz: 6193020d474b6c3868abc58a633736652f2bface
4
+ data.tar.gz: 8fec9d538fc88e8706a27f6a6eb009a45e0d2368
5
5
  SHA512:
6
- metadata.gz: 9cd1afd63950ac89df8c4110494809b1816812c8a4191d410efc93fb9e0c8f0a562ca89b184118d00c8ecf0afe61a3ee41e5cc23861ae6295aa8467c5728640d
7
- data.tar.gz: f37cadd33797e2c95e76ccfc628891e4560232ea304712b0ef26c393b410caab57b563dd6b81b8413d617c17c89c301ba735014c8881d004cab434f41b8e8adb
6
+ metadata.gz: f39b661759572f31166f54ca5839eef3260b0b426ab0db32422f310632508b65ed57e35a247397dc0bc7307601cf88cae72be7d1b36b0f6467299420cf454c2d
7
+ data.tar.gz: 785951c200e8749f45c42a91754849d7cc5533d6b6598a70823fcf18d6dcb5ea7c8b272f091c6ae75d8ee404dac668c039781938637ed98d6236a433c83ecefc
@@ -56,6 +56,7 @@ module FinApps
56
56
  filter.merge!(search_query(params[:searchTerm])) if params[:searchTerm]
57
57
  filter.merge!(status_query(params[:status])) if params[:status]
58
58
  filter.merge!(assignment_query(params[:assignment])) if params.key?(:assignment) # assignment can be nil
59
+ filter.merge!(relation_query(params[:relation])) if !params[:searchTerm] && !nil_or_empty?(params[:relation])
59
60
  filter
60
61
  end
61
62
 
@@ -92,6 +93,15 @@ module FinApps
92
93
  def assignment_query(assignment)
93
94
  {"assignment.operator_id": assignment}
94
95
  end
96
+
97
+ def relation_query(relation)
98
+ {
99
+ "$or": [
100
+ {"public_id": {"$in": relation}},
101
+ {"original_order_id": {"$in": relation}}
102
+ ]
103
+ }
104
+ end
95
105
  end
96
106
  end
97
107
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '2.3.5'
4
+ VERSION = '2.3.6'
5
5
  end
@@ -78,7 +78,7 @@ RSpec.describe FinApps::REST::Orders do
78
78
  subject { FinApps::REST::Orders.new(client).list(params) }
79
79
  let(:params) do
80
80
  {page: 2, sort: 'status', requested: 25, searchTerm: 'term', status: %w(1 7),
81
- assignment: 'valid_operator'}
81
+ assignment: 'valid_operator', relation: ['valid_order_id']}
82
82
  end
83
83
 
84
84
  it { expect { subject }.not_to raise_error }
@@ -96,6 +96,15 @@ RSpec.describe FinApps::REST::Orders do
96
96
  'valid_operator%22%7D&page=2&requested=25&sort=status'
97
97
  expect(WebMock).to have_requested(:get, url)
98
98
  end
99
+ it 'builds query and sends proper request with searchTerm/relation exclusivity' do
100
+ params[:searchTerm] = nil
101
+ subject
102
+ url = "#{FinAppsCore::REST::Defaults::DEFAULTS[:host]}/v2/orders?filter=%7B%22status%22:%7B%22$in%22:%5B1," \
103
+ '7%5D%7D,%22assignment.operator_id%22:%22valid_operator%22,%22$or%22:%5B%7B%22public_id%22:%7B%22$in' \
104
+ '%22:%5B%22valid_order_id%22%5D%7D%7D,%7B%22original_order_id%22:%7B%22$in%22:%5B%22valid_order_id%22' \
105
+ '%5D%7D%7D%5D%7D&page=2&requested=25&sort=status'
106
+ expect(WebMock).to have_requested(:get, url)
107
+ end
99
108
  end
100
109
  end
101
110
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finapps
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.5
4
+ version: 2.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero