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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9829e572c44feada438e80842fa2d7878d97d47f
4
- data.tar.gz: c3759b5fd1bc1d723e290743baea682c873e75bc
3
+ metadata.gz: 5b6e6a3468fc1757df4b358a7f521fe32d94e455
4
+ data.tar.gz: 856c8f50608e8084528344fc89c37e5277cc8e11
5
5
  SHA512:
6
- metadata.gz: 528c2382d9c6eff3d6dcd60368654039ab56ab18d0280b4c5ece685626ccd44a8a04fc7259d1a7037fc07abd03d456ae69dcfabc4dd3306eefc8868b2e6aeb8e
7
- data.tar.gz: 73648771cd9d7f0e8d5a98d099a5ecae310e105b4c28e7ba69c7c29ddcfff7cafed8b783bcc7f8341087d8992d8314420a57a80d6035ad50108f38d2334426bc
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)
@@ -1,3 +1,3 @@
1
1
  module Stream
2
- VERSION = "2.1.3"
2
+ VERSION = "2.1.4"
3
3
  end
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.3
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-07 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty