stream-ruby 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/stream/client.rb +5 -4
- data/lib/stream/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b6e6a3468fc1757df4b358a7f521fe32d94e455
|
4
|
+
data.tar.gz: 856c8f50608e8084528344fc89c37e5277cc8e11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63268718ab521073158953dcf4625913544e224df1ec71c4be95f795b6b6f21df9ead1f611ed66d7ac994b5b5a0244c552603c73aae3fd9cba53735067087d0d
|
7
|
+
data.tar.gz: 33ab5d87d4016bc853549be59dce853d530723345bfeb4acd4f9b382716fd4daf712c87be82fe986d7051dbd10e287d4b1463991d0be51e22fa68bd7a112a0d1
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ gem install "stream-ruby"
|
|
20
20
|
### Usage
|
21
21
|
|
22
22
|
```ruby
|
23
|
-
# Instantiate a new client
|
23
|
+
# Instantiate a new client to connect to us east API endpoint
|
24
24
|
require 'stream'
|
25
25
|
client = Stream::Client.new('YOUR_API_KEY', 'API_KEY_SECRET', 'APP_ID', :location => 'us-east')
|
26
26
|
# Find your API keys here https://getstream.io/dashboard/
|
data/lib/stream/client.rb
CHANGED
@@ -12,9 +12,9 @@ module Stream
|
|
12
12
|
attr_reader :app_id
|
13
13
|
attr_reader :api_version
|
14
14
|
attr_reader :location
|
15
|
+
attr_reader :default_timeout
|
15
16
|
|
16
17
|
def initialize(api_key='', api_secret='', app_id=nil, opts={})
|
17
|
-
|
18
18
|
if ENV['STREAM_URL'] =~ Stream::STREAM_URL_RE and (api_key.nil? || api_key.empty?)
|
19
19
|
matches = Stream::STREAM_URL_RE.match(ENV['STREAM_URL'])
|
20
20
|
api_key = matches['key']
|
@@ -32,6 +32,7 @@ module Stream
|
|
32
32
|
@app_id = app_id
|
33
33
|
@location = opts[:location]
|
34
34
|
@api_version = opts.fetch(:api_version, 'v1.0')
|
35
|
+
@default_timeout = opts.fetch(:default_timeout, 3)
|
35
36
|
@signer = Stream::Signer.new(api_secret)
|
36
37
|
end
|
37
38
|
|
@@ -45,7 +46,7 @@ module Stream
|
|
45
46
|
end
|
46
47
|
|
47
48
|
def get_http_client
|
48
|
-
StreamHTTPClient.new(@api_version, @location)
|
49
|
+
StreamHTTPClient.new(@api_version, @location, @default_timeout)
|
49
50
|
end
|
50
51
|
|
51
52
|
def make_request(method, relative_url, signature, params=nil, data=nil)
|
@@ -62,15 +63,15 @@ module Stream
|
|
62
63
|
class StreamHTTPClient
|
63
64
|
|
64
65
|
include HTTParty
|
65
|
-
default_timeout 3
|
66
66
|
|
67
|
-
def initialize(api_version='v1.0', location=nil)
|
67
|
+
def initialize(api_version='v1.0', location=nil, default_timeout=3)
|
68
68
|
if location.nil?
|
69
69
|
location_name = "api"
|
70
70
|
else
|
71
71
|
location_name = "#{location}-api"
|
72
72
|
end
|
73
73
|
self.class.base_uri "https://#{location_name}.getstream.io/api/#{api_version}"
|
74
|
+
self.class.default_timeout default_timeout
|
74
75
|
end
|
75
76
|
|
76
77
|
def make_http_request(method, relative_url, params=nil, data=nil, headers=nil)
|
data/lib/stream/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stream-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tommaso Barbugli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|