stream-chat-ruby 0.1.3 → 1.0.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
- SHA256:
3
- metadata.gz: 244e06d801241360619825d1d6dce2366be14e941586936172914c8ff8ca381b
4
- data.tar.gz: cdd4f68211d18916918fd0bc092b578c4f3bec58c9aa7cbf5b54753cfa9fb07b
2
+ SHA1:
3
+ metadata.gz: f33905fc20d905b773d08de0596be91bdf399031
4
+ data.tar.gz: 3f68209a47f4a0c6f78ec39be3322515e85855b8
5
5
  SHA512:
6
- metadata.gz: 63dfccf208150960ee69f5cf1042aad0fab9d73583613b6944949c87a69c3e896c30a6a1c3d5853407eae1640c956949219f8f09fb4866dcd25d6e36835971bb
7
- data.tar.gz: 7297789f705b700652c0d3cd73670c44cbda4970877879dec9e840d9c53f008e79d9e5e69564b1214bae2133d0a317bf315d53d972b3a80d9b4b3037789485e0
6
+ metadata.gz: dad5cb157613c0c83cf1f9db5acdb8d42882ae5cf7a8831b99afe48434b0bd598e0d73a942a0aeb25d9b0d3ae6f99fe9fb12b7de971b7c5c48496a59b4fc95ed
7
+ data.tar.gz: 4ffa4e56a649e549e5b2b88a92949e727648d183b23e53afe06b5e5e5bf3a4fb9da46c2a4bf5fd4a583e6b80057544df2113370179fe621fb55901dff2126965
@@ -0,0 +1,10 @@
1
+ ## Oct 19th, 2019 - 1.0.0
2
+
3
+ - Added `channel.hide` and `channel.show`
4
+ - Added `client.flag_message` and `client.unflag_message`
5
+ - Added `client.flag_user` and `client.unflag_user`
6
+ - Added `client.get_message`
7
+ - Added `client.search`
8
+ - Added `client.update_users_partial`
9
+ - Added `client.update_user_partial`
10
+ - Added `client.reactivate_user`
@@ -115,6 +115,14 @@ module StreamChat
115
115
  @client.unban_user(user_id, type: @channel_type, id: @id)
116
116
  end
117
117
 
118
+ def hide(user_id)
119
+ @client.post("#{url}/hide", data: {user_id: user_id})
120
+ end
121
+
122
+ def show(user_id)
123
+ @client.post("#{url}/show", data: {user_id: user_id})
124
+ end
125
+
118
126
  private
119
127
 
120
128
  def add_user_id(payload, user_id)
@@ -7,6 +7,7 @@ require 'stream-chat/version'
7
7
 
8
8
  module StreamChat
9
9
  class Client
10
+ BASE_URL = 'https://chat-us-east-1.stream-io-api.com'
10
11
 
11
12
  attr_reader :api_key
12
13
  attr_reader :api_secret
@@ -28,8 +29,8 @@ module StreamChat
28
29
  @api_secret = api_secret
29
30
  @timeout = timeout
30
31
  @options = options
31
- @base_url = 'https://chat-us-east-1.stream-io-api.com'
32
32
  @auth_token = JWT.encode({server: true}, @api_secret, 'HS256')
33
+ @base_url = options[:base_url] || BASE_URL
33
34
  @conn = Faraday.new(url: @base_url) do |faraday|
34
35
  faraday.options[:open_timeout] = @timeout
35
36
  faraday.options[:timeout] = @timeout
@@ -53,6 +54,39 @@ module StreamChat
53
54
  get('app')
54
55
  end
55
56
 
57
+ def flag_message(id, **options)
58
+ payload = {'target_message_id': id}.merge(options)
59
+ post("moderation/flag", data: payload)
60
+ end
61
+
62
+ def unflag_message(id, **options)
63
+ payload = {'target_message_id': id}.merge(options)
64
+ post("moderation/unflag", data: payload)
65
+ end
66
+
67
+ def flag_user(id, **options)
68
+ payload = {'target_user_id': id}.merge(options)
69
+ post("moderation/flag", data: payload)
70
+ end
71
+
72
+ def unflag_user(id, **options)
73
+ payload = {'target_user_id': id}.merge(options)
74
+ post("moderation/unflag", data: payload)
75
+ end
76
+
77
+ def get_message(id)
78
+ get("messages/#{id}")
79
+ end
80
+
81
+ def search(filter_conditions, query, **options)
82
+ params = options.merge({
83
+ "filter_conditions": filter_conditions,
84
+ "query": query,
85
+ })
86
+
87
+ get("search", params: {"payload": params.to_json})
88
+ end
89
+
56
90
  def update_users(users)
57
91
  payload = {}
58
92
  users.each do |user|
@@ -62,7 +96,15 @@ module StreamChat
62
96
  end
63
97
 
64
98
  def update_user(user)
65
- update_users([user])
99
+ update_users([user])
100
+ end
101
+
102
+ def update_users_partial(updates)
103
+ patch('users', data: {'users': updates})
104
+ end
105
+
106
+ def update_user_partial(update)
107
+ update_users_partial([update])
66
108
  end
67
109
 
68
110
  def delete_user(user_id, **options)
@@ -73,6 +115,10 @@ module StreamChat
73
115
  post("users/#{user_id}/deactivate", **options)
74
116
  end
75
117
 
118
+ def reactivate_user(user_id, **options)
119
+ post("users/#{user_id}/reactivate", **options)
120
+ end
121
+
76
122
  def export_user(user_id, **options)
77
123
  get("users/#{user_id}/export", params: options)
78
124
  end
@@ -1,5 +1,5 @@
1
1
  # lib/version.rb
2
2
 
3
3
  module StreamChat
4
- VERSION = "0.1.3".freeze
4
+ VERSION = "1.0.0".freeze
5
5
  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: 0.1.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mircea Cosbuc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-24 00:00:00.000000000 Z
11
+ date: 2019-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -88,6 +88,7 @@ extra_rdoc_files: []
88
88
  files:
89
89
  - ".gitignore"
90
90
  - ".travis.yml"
91
+ - CHANGELOG.md
91
92
  - Gemfile
92
93
  - LICENSE
93
94
  - PULL_REQUEST_TEMPLATE.md
@@ -117,7 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
- rubygems_version: 3.0.3
121
+ rubyforge_project:
122
+ rubygems_version: 2.4.7
121
123
  signing_key:
122
124
  specification_version: 4
123
125
  summary: The low level client for serverside calls for Stream Chat.