stream-chat-ruby 2.10.0 → 2.11.3

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
  SHA256:
3
- metadata.gz: e9f49f20f526f3ddd42becd925d877020fea2b4afdca80327a1d31beeafcdd76
4
- data.tar.gz: d38e3c3390338c96f30ff692459aebd0c54addab98071130e089b9aed9a5ec13
3
+ metadata.gz: 8c930a4ce8f695581d1dbf0eb027fc94433a2bdf126cf626ef243dd7c78b572c
4
+ data.tar.gz: dcbe225ab70ddb6088bb7a8478e003ddcb6fb2d4a53fd9e113137257bc6464ce
5
5
  SHA512:
6
- metadata.gz: a58994964df76b94ef804b25372acdf6cfe2d142f32fdfed54be0bcff81d5203ec5d8e38e5c0a0f216e43b2ba4713a35e722fa8eff92204f95e458a5ce3644a7
7
- data.tar.gz: 721e797d9968d088e90578548794457812e483c50ff12d138fbbbda37af3f5328d7290fb97103ea82b164462182a45a18bb64185c1d0df27e06cd3e6064befdf
6
+ metadata.gz: 70346465f94bf6d84ffb0d98d5852f27bfd5a17dcb349238f19e7398fcb3061bbb10c3e3eedd62ff65b1c2a1158cb267903ec4fda9a4cfae5d3aa77ce31d3eff
7
+ data.tar.gz: 61aa20fe924e7a16f454593c223b4abcbf78d4bcbe1e7443876ca7194d64f9167e826f47a856276cf1fbef68be86868ed3d3ad6003692054c9d5e811cc770c59
@@ -0,0 +1 @@
1
+ * @ffenix113
@@ -1,9 +1,9 @@
1
- name: build
1
+ name: test
2
2
 
3
3
  on: [pull_request]
4
4
 
5
5
  jobs:
6
- build:
6
+ test:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  max-parallel: 1
@@ -12,15 +12,14 @@ jobs:
12
12
  name: Ruby ${{ matrix.ruby }}
13
13
  steps:
14
14
  - uses: actions/checkout@v2
15
- - uses: actions/setup-ruby@v1
15
+ - uses: ruby/setup-ruby@v1
16
16
  with:
17
17
  ruby-version: ${{ matrix.ruby }}
18
+ bundler-cache: true
18
19
 
19
20
  - env:
20
21
  STREAM_CHAT_API_KEY: ${{ secrets.STREAM_CHAT_API_KEY }}
21
22
  STREAM_CHAT_API_SECRET: ${{ secrets.STREAM_CHAT_API_SECRET }}
22
23
  run: |
23
- gem install bundler
24
- bundle install --jobs 4 --retry 3
25
24
  bundle exec rake rubocop
26
25
  bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## October 22nd, 2021 - 2.11.3
2
+
3
+ - Don't log the entire response when creating exception
4
+ - Access error details through StreamAPIException class attr_readers
5
+
6
+ ## October 5th, 2021 - 2.11.2
7
+
8
+ - Add Codeowners file
9
+ - Fix StreamChannelException raises
10
+ - Fix rubocop linting error
11
+ - Fix channel export test
12
+ - Update Github action
13
+
14
+ ## August 23rd, 2021 - 2.11.1
15
+
16
+ - Use edge as base url
17
+
18
+ ## June 25th, 2021 - 2.11.0
19
+
20
+ - Add support for improved search
21
+
1
22
  ## June 4th, 2021 - 2.10.0
2
23
 
3
24
  - Add custom command CRUD support
@@ -19,7 +19,7 @@ module StreamChat
19
19
  end
20
20
 
21
21
  def url
22
- raise StreamChannelException 'channel does not have an id' if @id.nil?
22
+ raise StreamChannelException, 'channel does not have an id' if @id.nil?
23
23
 
24
24
  "channels/#{@channel_type}/#{@id}"
25
25
  end
@@ -85,7 +85,7 @@ module StreamChat
85
85
  end
86
86
 
87
87
  def update_partial(set = nil, unset = nil)
88
- raise StreamChannelException 'set or unset is needed' if set.nil? && unset.nil?
88
+ raise StreamChannelException, 'set or unset is needed' if set.nil? && unset.nil?
89
89
 
90
90
  payload = { set: set, unset: unset }
91
91
  @client.patch(url, data: payload)
@@ -14,7 +14,7 @@ module StreamChat
14
14
  DEFAULT_BLOCKLIST = 'profanity_en_2020_v1'
15
15
 
16
16
  class Client
17
- BASE_URL = 'https://chat-us-east-1.stream-io-api.com'
17
+ BASE_URL = 'https://chat.stream-io-api.com'
18
18
 
19
19
  attr_reader :api_key
20
20
  attr_reader :api_secret
@@ -92,13 +92,21 @@ module StreamChat
92
92
  get("messages/#{id}")
93
93
  end
94
94
 
95
- def search(filter_conditions, query, **options)
96
- params = options.merge({
97
- filter_conditions: filter_conditions,
98
- query: query
99
- })
95
+ def search(filter_conditions, query, sort: nil, **options)
96
+ offset = options[:offset]
97
+ next_value = options[:next]
98
+ raise ArgumentError, 'cannot use offset with next or sort parameters' if offset&.positive? && (next_value || (!sort.nil? && !sort.empty?))
100
99
 
101
- get('search', params: { payload: params.to_json })
100
+ to_merge = {
101
+ filter_conditions: filter_conditions,
102
+ sort: get_sort_fields(sort)
103
+ }
104
+ if query.is_a? String
105
+ to_merge[:query] = query
106
+ else
107
+ to_merge[:message_filter_conditions] = query
108
+ end
109
+ get('search', params: { payload: options.merge(to_merge).to_json })
102
110
  end
103
111
 
104
112
  def update_users(users)
@@ -405,7 +413,7 @@ module StreamChat
405
413
  headers['Authorization'] = @auth_token
406
414
  headers['stream-auth-type'] = 'jwt'
407
415
  url = [@base_url, relative_url].join('/')
408
- params = params.nil? ? {} : params
416
+ params = {} if params.nil?
409
417
  params = (get_default_params.merge(params).sort_by { |k, _v| k.to_s }).to_h
410
418
  url = "#{url}?#{URI.encode_www_form(params)}"
411
419
 
@@ -4,10 +4,12 @@
4
4
 
5
5
  module StreamChat
6
6
  class StreamAPIException < StandardError
7
+ attr_reader :error_code
8
+ attr_reader :error_message
9
+
7
10
  def initialize(response)
8
11
  super()
9
12
  @response = response
10
- p response
11
13
  begin
12
14
  parsed_response = JSON.parse(response.body)
13
15
  @json_response = true
@@ -25,6 +27,14 @@ module StreamChat
25
27
  "StreamChat error HTTP code: #{@response.status}"
26
28
  end
27
29
  end
30
+
31
+ def json_response?
32
+ @json_response
33
+ end
34
+
35
+ def to_s
36
+ message
37
+ end
28
38
  end
29
39
 
30
40
  class StreamChannelException < StandardError; end
@@ -3,5 +3,5 @@
3
3
  # lib/version.rb
4
4
 
5
5
  module StreamChat
6
- VERSION = '2.10.0'
6
+ VERSION = '2.11.3'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stream-chat-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mircea Cosbuc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-04 00:00:00.000000000 Z
11
+ date: 2021-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -86,6 +86,7 @@ executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
+ - ".github/CODEOWNERS"
89
90
  - ".github/workflows/ci.yml"
90
91
  - ".gitignore"
91
92
  - ".rubocop.yml"
@@ -120,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
121
  - !ruby/object:Gem::Version
121
122
  version: '0'
122
123
  requirements: []
123
- rubygems_version: 3.1.2
124
+ rubygems_version: 3.0.3
124
125
  signing_key:
125
126
  specification_version: 4
126
127
  summary: The low level client for serverside calls for Stream Chat.