stream-ruby 2.5.2 → 2.5.4

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: 2ce02081ea1f17035579e108bba1cbdf7c9a7bbb
4
- data.tar.gz: 7ba8024cea61c62d3a5d96258c5898d0f5736743
3
+ metadata.gz: 323fa2b0fe0631721c6675a2858af90cb02e6489
4
+ data.tar.gz: 4d8d2885ca77326b1fc712ed9f18fba3b9bcc150
5
5
  SHA512:
6
- metadata.gz: 6ec05500fda1558b24ae2ae768c4165b0e267dfbd9a6a5ad7f8799c80209bb17907f124fe75dcfb7709f4c591ce7649620f5923377b901b5301a1ea7b359404b
7
- data.tar.gz: 57c513a2c7b9920c1cdfd593959fe35d2458ee1b8288bf9f385be96fc0acf17f64854cad502cfb18b5685122c917dc75c861abb90d4b5b1fbc0b11bf8f4073cc
6
+ metadata.gz: 57d7d87fc03bec734879219985a41ac4e102bad75c661d6579c5ed2061eb0a8d22f851cac75bc9808098eb05bd5a0c0f6c700d9264dac4ed56a623f51e58d62e
7
+ data.tar.gz: 2982e5270d7fe5848fa892cdc80afcfb778ac6f1c8d65a423a69b48c0a3865c012d999c328fdd9f8a7db43bbd9aa39821c18645e84309f0a3015ee7f54462256
data/LICENSE CHANGED
@@ -1,27 +1,27 @@
1
- Copyright (c) 2014, Stream.io Inc
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
- modification, are permitted provided that the following conditions are met:
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
- * Redistributions of source code must retain the above copyright notice, this
8
- list of conditions and the following disclaimer.
8
+ 1. Redistributions of source code must retain the above copyright notice, this list of
9
+ conditions and the following disclaimer.
9
10
 
10
- * Redistributions in binary form must reproduce the above copyright notice,
11
- this list of conditions and the following disclaimer in the documentation
12
- and/or other materials provided with the distribution.
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
- * Neither the name of the {organization} nor the names of its
15
- contributors may be used to endorse or promote products derived from
16
- this software without specific prior written permission.
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
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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 = "https"
116
- if @options[:location] == "qa"
117
- protocol = "http"
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, "something else")
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 error_message(response, body = nil)
179
- "#{response[:method].to_s.upcase} #{response[:url]}: #{[response[:status].to_s + ':', body].compact.join(' ')}"
180
- end
181
-
182
- def error_body(body)
183
- if !body.nil? && !body.empty? && body.is_a?(String)
184
- body = ::JSON.parse(body)
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
- if body.nil?
188
- nil
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
@@ -1,3 +1,3 @@
1
1
  module Stream
2
- VERSION = "2.5.2".freeze
2
+ VERSION = "2.5.4".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: 2.5.2
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-02-19 00:00:00.000000000 Z
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.4.7
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