stream-ruby 2.5.2 → 2.5.4
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 +4 -4
- data/LICENSE +21 -21
- data/README.md +6 -0
- data/lib/stream/client.rb +22 -19
- data/lib/stream/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 323fa2b0fe0631721c6675a2858af90cb02e6489
|
4
|
+
data.tar.gz: 4d8d2885ca77326b1fc712ed9f18fba3b9bcc150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d7d87fc03bec734879219985a41ac4e102bad75c661d6579c5ed2061eb0a8d22f851cac75bc9808098eb05bd5a0c0f6c700d9264dac4ed56a623f51e58d62e
|
7
|
+
data.tar.gz: 2982e5270d7fe5848fa892cdc80afcfb778ac6f1c8d65a423a69b48c0a3865c012d999c328fdd9f8a7db43bbd9aa39821c18645e84309f0a3015ee7f54462256
|
data/LICENSE
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
Copyright (c) 2014
|
1
|
+
Copyright (c) 2014-2017 Stream.io Inc, and individual contributors.
|
2
|
+
|
2
3
|
All rights reserved.
|
3
4
|
|
4
|
-
Redistribution and use in source and binary forms, with or without
|
5
|
-
|
5
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
6
|
+
provided that the following conditions are met:
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this list of
|
9
|
+
conditions and the following disclaimer.
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of
|
12
|
+
conditions and the following disclaimer in the documentation and/or other materials
|
13
|
+
provided with the distribution.
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
3. Neither the name of the copyright holder nor the names of its contributors may
|
16
|
+
be used to endorse or promote products derived from this software without specific prior
|
17
|
+
written permission.
|
17
18
|
|
18
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
20
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21
|
+
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
22
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
23
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
25
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
26
|
+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27
|
+
POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
@@ -114,3 +114,9 @@ client.add_to_many(activity, feeds)
|
|
114
114
|
```
|
115
115
|
|
116
116
|
Docs are available on [GetStream.io](http://getstream.io/docs/).
|
117
|
+
|
118
|
+
### Copyright and License Information
|
119
|
+
|
120
|
+
Copyright (c) 2014-2017 Stream.io Inc, and individual contributors. All rights reserved.
|
121
|
+
|
122
|
+
See the file "LICENSE" for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.
|
data/lib/stream/client.rb
CHANGED
@@ -112,13 +112,18 @@ module Stream
|
|
112
112
|
location_name = "#{client_params[:location]}-api"
|
113
113
|
end
|
114
114
|
|
115
|
-
protocol =
|
116
|
-
|
117
|
-
|
115
|
+
protocol = 'https'
|
116
|
+
port = ':443'
|
117
|
+
if @options[:location] == "qa" || @options[:location] == "localhost"
|
118
|
+
protocol = 'http'
|
119
|
+
port = ':80'
|
120
|
+
if @options[:location] == 'localhost'
|
121
|
+
port = ':8000'
|
122
|
+
end
|
118
123
|
end
|
119
124
|
|
120
125
|
@base_path = "/api/#{@options[:api_version]}"
|
121
|
-
base_url = "#{protocol}://#{location_name}.getstream.io#{@base_path}"
|
126
|
+
base_url = "#{protocol}://#{location_name}.getstream.io#{port}#{@base_path}"
|
122
127
|
|
123
128
|
@conn = Faraday.new(:url => base_url) do |faraday|
|
124
129
|
# faraday.request :url_encoded
|
@@ -163,11 +168,12 @@ module Stream
|
|
163
168
|
when 404
|
164
169
|
raise StreamApiResponseException, error_message(response, "url not found")
|
165
170
|
when 204...600
|
166
|
-
raise StreamApiResponseException, error_message(response,
|
171
|
+
raise StreamApiResponseException, error_message(response, _build_error_message(response.body))
|
167
172
|
end
|
168
173
|
end
|
169
174
|
end
|
170
175
|
|
176
|
+
|
171
177
|
def initialize(app)
|
172
178
|
super app
|
173
179
|
@parser = nil
|
@@ -175,22 +181,19 @@ module Stream
|
|
175
181
|
|
176
182
|
private
|
177
183
|
|
178
|
-
def
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
184
|
+
def _build_error_message(response)
|
185
|
+
response = JSON.parse(response)
|
186
|
+
msg = "#{response['exception']} details: #{response['detail']}"
|
187
|
+
if response.key?("exception_fields")
|
188
|
+
response["exception_fields"].map do |field, messages|
|
189
|
+
msg << "\n#{field}: #{messages}"
|
190
|
+
end
|
185
191
|
end
|
192
|
+
msg
|
193
|
+
end
|
186
194
|
|
187
|
-
|
188
|
-
|
189
|
-
elsif body["meta"] && body["meta"]["error_message"] && !body["meta"]["error_message"].empty?
|
190
|
-
": #{body['meta']['error_message']}"
|
191
|
-
elsif body["error_message"] && !body["error_message"].empty?
|
192
|
-
": #{body['error_type']}: #{body['error_message']}"
|
193
|
-
end
|
195
|
+
def error_message(response, body = nil)
|
196
|
+
"#{response[:method].to_s.upcase} #{response[:url]}: #{[response[:status].to_s + ':', body].compact.join(' ')}"
|
194
197
|
end
|
195
198
|
end
|
196
199
|
end
|
data/lib/stream/version.rb
CHANGED
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: 2.5.
|
4
|
+
version: 2.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tommaso Barbugli
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-03-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -135,9 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.
|
138
|
+
rubygems_version: 2.6.6
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: A gem that provides a client interface for getstream.io
|
142
142
|
test_files: []
|
143
|
-
has_rdoc: true
|