stream-ruby 2.0.1 → 2.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6fcbf1414da826ca0847d174cdbb3f50900bb89
4
- data.tar.gz: 0380274c1c63e9f7127f190ae115a92944536a1d
3
+ metadata.gz: eab10be5be6013c4a6a81c76581ffd3555be8841
4
+ data.tar.gz: c20d7926254dd705054ed831d90186c43ca6dbb8
5
5
  SHA512:
6
- metadata.gz: 4214eebb98858a49837069a8dac51bc819ea7f0251edcaea2c0eaa291fc84fc3911dc2181a2571cbf96f7bb1f33e0bdbf5408157e690fe8692d6280260f67baa
7
- data.tar.gz: 29c8b7af50f7505d00925e6eef0cbccc30033a3b9698293a8f3490e481a263b4040c8cc323675e5043ece160b39fcbcdafd5da0df7d7df1361347c1220d56249
6
+ metadata.gz: 4a71d61531bf77890e2e479f46a46023e0267905ca0bc7973f9817d1605ff90a004df37dea20e278b0bc2fc0550667787c44facd8302fe1741dcc4145fd42dec
7
+ data.tar.gz: 1bec41da48e55c6277720ebddcb6cda00befd9f9955d23b037042219c5e9e884a913df4816b2fdcd683b20212b8b006374dd728eeccb4c2e7fe8e5195bc4d1fd
data/README.md CHANGED
@@ -1,16 +1,22 @@
1
1
  stream-ruby
2
2
  ===========
3
- [![Gem Version](https://badge.fury.io/rb/stream-ruby.svg)](http://badge.fury.io/rb/stream-ruby)
3
+
4
+ [![Build Status](https://travis-ci.org/GetStream/stream-ruby.svg?branch=master)](https://travis-ci.org/GetStream/stream-ruby) [![Gem Version](https://badge.fury.io/rb/stream-ruby.svg)](http://badge.fury.io/rb/stream-ruby)
5
+
6
+
7
+
4
8
 
5
9
  stream-ruby is a Ruby client for [Stream](https://getstream.io/).
6
10
 
11
+ **Users of versions < 2.0.0, Stream::Feed constructor signature and other methods has changed. Please read this before upgrading:** [Breaking Changes](http://github.com/GetStream/stream-ruby/blob/master/upgrading.txt)
12
+
13
+
7
14
  ### Installation
8
15
 
9
16
  ```bash
10
17
  gem install "stream-ruby"
11
18
  ```
12
19
 
13
-
14
20
  ### Usage
15
21
 
16
22
  ```ruby
@@ -73,7 +79,7 @@ user_feed_1.delete
73
79
  token = user_feed_1.token
74
80
 
75
81
  # Javascript client side feed initialization
76
- # user1 = client.feed('user:1', '{{ token }}');
82
+ # user1 = client.feed('user', '1', '{{ token }}');
77
83
 
78
84
  # Retrieve first 10 followers of a feed
79
85
  user_feed_1.followers(0, 10)
data/lib/stream/base.rb CHANGED
@@ -2,6 +2,7 @@ require 'json'
2
2
  require 'stream/client'
3
3
  require 'stream/version'
4
4
  require 'stream/signer'
5
+ require 'stream/exceptions'
5
6
 
6
7
  module Stream
7
8
  class << self
@@ -2,4 +2,7 @@ module Stream
2
2
 
3
3
  class StreamApiResponseException < Exception
4
4
  end
5
+
6
+ class StreamInputData < Exception
7
+ end
5
8
  end
data/lib/stream/feed.rb CHANGED
@@ -12,6 +12,15 @@ module Stream
12
12
  attr_reader :signature
13
13
 
14
14
  def initialize(client, feed_slug, user_id, token)
15
+
16
+ if !self.valid_feed_slug feed_slug
17
+ raise StreamInputData, "feed_slug can only contain alphanumeric characters plus \"_\""
18
+ end
19
+
20
+ if !self.valid_user_id user_id
21
+ raise StreamInputData, "user_id can only contain alphanumeric characters plus \"_\""
22
+ end
23
+
15
24
  @id = "#{feed_slug}:#{user_id}"
16
25
  @client = client
17
26
  @user_id = user_id
@@ -21,6 +30,14 @@ module Stream
21
30
  @signature = "#{feed_slug}#{user_id} #{token}"
22
31
  end
23
32
 
33
+ def valid_feed_slug(feed_slug)
34
+ !feed_slug[/^\w+$/].nil?
35
+ end
36
+
37
+ def valid_user_id(user_id)
38
+ !user_id[/^\w+$/].nil?
39
+ end
40
+
24
41
  def get(params = {})
25
42
  uri = "/feed/#{@feed_url}/"
26
43
  if params[:mark_read] and params[:mark_read].kind_of?(Array)
@@ -90,8 +107,8 @@ module Stream
90
107
  def following(offset=0, limit=25, filter=[])
91
108
  uri = "/feed/#{@feed_url}/follows/"
92
109
  params = {
93
- 'limit' => limit,
94
110
  'offset' => offset,
111
+ 'limit' => limit,
95
112
  'filter' => filter.join(",")
96
113
  }
97
114
  @client.make_request(:get, uri, @signature, params)
@@ -1,3 +1,3 @@
1
1
  module Stream
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
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.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommaso Barbugli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-10 00:00:00.000000000 Z
11
+ date: 2014-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -108,7 +108,7 @@ files:
108
108
  - lib/stream/feed.rb
109
109
  - lib/stream/signer.rb
110
110
  - lib/stream/version.rb
111
- homepage: http://github.com/tbarbugli/stream-ruby
111
+ homepage: http://github.com/GetStream/stream-ruby
112
112
  licenses:
113
113
  - Apache-2.0
114
114
  metadata: {}