stream-ruby 4.1.0 → 4.5.0

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: 9aef0477b7b269f76432beea87cab0b7d41e5887ffdb69100abd1096421028c5
4
- data.tar.gz: a0974c2b7e0d8967656f7433ea04b7ece51cfb72253aede20793710e6cb318f8
3
+ metadata.gz: ae1395d26cf2fc594224dfc4fb2acd18d5b9ecacb5c8def51ce8df295e1fead8
4
+ data.tar.gz: 4765a2b7e087bc060e22d14eca4ee37875c24d802c21455655eaa0c44b466ada
5
5
  SHA512:
6
- metadata.gz: 9838aedac28f96372299682572fc3de5a4c8e946ebe1d60dc5851c5cafe26a2ea9d3c44aca46f8e851d2337021e49da77442306db67cca95c30002b06b9267ad
7
- data.tar.gz: 76c77e37c537150587dfff557b6b3870276f1ce87054119a5653960b7dc07c6cce9d9bf2e250af937d6fbb0fa674316fbd62127c61facff850b6bb6758391feb
6
+ metadata.gz: ca9c4dc2e6978ccc1961821c6375607bd4ad10f22ffd3f950bf1493a616d4262b6e027cd26cee507260b6238814854edafe0b6a9b7fbc54732430693422bdbd3
7
+ data.tar.gz: 81996ad7e64df4fb2da41487a05570395a185000c2dd5124721b637959f7c6c2782d40089dc8461933d93654f145c3872ae3167b727c8ee8cd8cc1243744e81d
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2021 Stream.io Inc, and individual contributors.
1
+ Copyright (c) 2014-2021, Stream.io Inc, and individual contributors.
2
2
 
3
3
  All rights reserved.
4
4
 
data/README.md CHANGED
@@ -153,6 +153,11 @@ client.og('https://google.com')
153
153
 
154
154
  ### Copyright and License Information
155
155
 
156
- Copyright (c) 2014-2021 Stream.io Inc, and individual contributors. All rights reserved.
156
+ Project is licensed under the [BSD 3-Clause](LICENSE).
157
157
 
158
- See the file "LICENSE" for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.
158
+ ## We are hiring!
159
+
160
+ We've recently closed a [$38 million Series B funding round](https://techcrunch.com/2021/03/04/stream-raises-38m-as-its-chat-and-activity-feed-apis-power-communications-for-1b-users/) and we keep actively growing.
161
+ Our APIs are used by more than a billion end-users, and you'll have a chance to make a huge impact on the product within a team of the strongest engineers all over the world.
162
+
163
+ Check out our current openings and apply via [Stream's website](https://getstream.io/team/#jobs).
@@ -36,8 +36,25 @@ module Stream
36
36
  timestamps: timestamps
37
37
  }
38
38
  end
39
+
40
+ uri = params[:enrich] || params[:reactions] ? '/enrich/activities/' : '/activities/'
41
+ if params[:reactions].respond_to?(:keys)
42
+ params[:withOwnReactions] = true if params[:reactions][:own]
43
+ params[:withFirstReactions] = true if params[:reactions][:first]
44
+ params[:withRecentReactions] = true if params[:reactions][:recent]
45
+ params[:withReactionCounts] = true if params[:reactions][:counts]
46
+ params[:withOwnChildren] = true if params[:reactions][:children]
47
+ user_id = params[:reactions][:user_id]
48
+ params[:user_id] = user_id if user_id
49
+ kinds = params[:reactions][:kinds]
50
+ if kinds
51
+ params[:reactionKindsFilter] = kinds.is_a?(Array) ? kinds.join(',') : kinds
52
+ end
53
+ end
54
+ %i[enrich reactions].each { |k| params.delete(k) }
55
+
39
56
  signature = Stream::Signer.create_jwt_token('activities', '*', @api_secret, '*')
40
- make_request(:get, '/activities/', signature, params)
57
+ make_request(:get, uri, signature, params)
41
58
  end
42
59
 
43
60
  #
data/lib/stream/client.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'faraday'
2
+ require 'faraday/net_http_persistent'
2
3
  require 'stream/errors'
3
4
  require 'stream/feed'
4
5
  require 'stream/signer'
@@ -170,7 +171,10 @@ module Stream
170
171
  faraday.use RaiseHttpException
171
172
  faraday.options[:open_timeout] = @options[:default_timeout]
172
173
  faraday.options[:timeout] = @options[:default_timeout]
173
- faraday.adapter Faraday.default_adapter
174
+ faraday.adapter :net_http_persistent, pool_size: 5 do |http|
175
+ # AWS load balancer idle timeout is 60 secs, so let's make it 59
176
+ http.idle_timeout = 59
177
+ end
174
178
  end
175
179
  @base_path = url_generator.base_path
176
180
  @conn.path_prefix = base_path
data/lib/stream/feed.rb CHANGED
@@ -42,8 +42,16 @@ module Stream
42
42
  params[:mark_seen] = params[:mark_seen].join(',') if params[:mark_seen]&.is_a?(Array)
43
43
  if params[:reactions].respond_to?(:keys)
44
44
  params[:withOwnReactions] = true if params[:reactions][:own]
45
+ params[:withFirstReactions] = true if params[:reactions][:first]
45
46
  params[:withRecentReactions] = true if params[:reactions][:recent]
46
47
  params[:withReactionCounts] = true if params[:reactions][:counts]
48
+ params[:withOwnChildren] = true if params[:reactions][:children]
49
+ user_id = params[:reactions][:user_id]
50
+ params[:user_id] = user_id if user_id
51
+ kinds = params[:reactions][:kinds]
52
+ if kinds
53
+ params[:reactionKindsFilter] = kinds.is_a?(Array) ? kinds.join(',') : kinds
54
+ end
47
55
  end
48
56
  %i[enrich reactions].each { |k| params.delete(k) }
49
57
 
@@ -1,12 +1,13 @@
1
1
  module Stream
2
2
  class ReactionsClient < Client
3
- def add(kind, activity_id, user_id, data: nil, target_feeds: nil)
3
+ def add(kind, activity_id, user_id, data: nil, target_feeds: nil, target_feeds_extra_data: nil)
4
4
  data = {
5
5
  kind: kind,
6
6
  activity_id: activity_id,
7
7
  user_id: user_id,
8
8
  data: data,
9
- target_feeds: target_feeds
9
+ target_feeds: target_feeds,
10
+ target_feeds_extra_data: target_feeds_extra_data
10
11
  }
11
12
  make_reaction_request(:post, {}, data)
12
13
  end
@@ -30,13 +31,14 @@ module Stream
30
31
  make_reaction_request(:delete, {}, {}, endpoint: uri)
31
32
  end
32
33
 
33
- def add_child(kind, parent_id, user_id, data: nil, target_feeds: nil)
34
+ def add_child(kind, parent_id, user_id, data: nil, target_feeds: nil, target_feeds_extra_data: nil)
34
35
  data = {
35
36
  kind: kind,
36
37
  parent: parent_id,
37
38
  user_id: user_id,
38
39
  data: data,
39
- target_feeds: target_feeds
40
+ target_feeds: target_feeds,
41
+ target_feeds_extra_data: target_feeds_extra_data
40
42
  }
41
43
  make_reaction_request(:post, {}, data)
42
44
  end
@@ -55,7 +57,7 @@ module Stream
55
57
  field = 'user_id'
56
58
  value = params[:user_id]
57
59
  end
58
- params.delete(field.to_sym) unless field.empty?
60
+ params.delete(field.to_sym) unless field.empty? && field != 'user_id'
59
61
  uri = if kind.nil? || kind.empty?
60
62
  "/reaction/#{field}/#{value}/"
61
63
  else
@@ -1,3 +1,3 @@
1
1
  module Stream
2
- VERSION = '4.1.0'.freeze
2
+ VERSION = '4.5.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stream-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommaso Barbugli
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-03-15 00:00:00.000000000 Z
13
+ date: 2022-01-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
@@ -26,6 +26,20 @@ dependencies:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
+ - !ruby/object:Gem::Dependency
30
+ name: faraday-net_http_persistent
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
29
43
  - !ruby/object:Gem::Dependency
30
44
  name: jwt
31
45
  requirement: !ruby/object:Gem::Requirement
@@ -40,6 +54,20 @@ dependencies:
40
54
  - - ">="
41
55
  - !ruby/object:Gem::Version
42
56
  version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: net-http-persistent
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
43
71
  - !ruby/object:Gem::Dependency
44
72
  name: rake
45
73
  requirement: !ruby/object:Gem::Requirement
@@ -110,7 +138,12 @@ files:
110
138
  homepage: http://github.com/GetStream/stream-ruby
111
139
  licenses:
112
140
  - BSD-3-Clause
113
- metadata: {}
141
+ metadata:
142
+ homepage_uri: https://getstream.io/activity-feeds/
143
+ bug_tracker_uri: https://github.com/GetStream/stream-ruby/issues
144
+ documentation_uri: https://getstream.io/activity-feeds/docs/ruby/?language=ruby
145
+ changelog_uri: https://github.com/GetStream/stream-ruby/blob/main/CHANGELOG.md
146
+ source_code_uri: https://github.com/GetStream/stream-ruby
114
147
  post_install_message:
115
148
  rdoc_options: []
116
149
  require_paths: