stream_rails 2.5.2 → 2.6.0

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: ec6bf2eb4ddd56e7c1f6f79f34eacde9c4a347bc
4
- data.tar.gz: 4ebbf3afbb2c43585d214eaf926fb0a69935e791
3
+ metadata.gz: 918a0d96ce448ae5d5a70af7ce1d503baa645cd7
4
+ data.tar.gz: 4de71bec91d909a6f77deebcea62857ecbec3da0
5
5
  SHA512:
6
- metadata.gz: 82cabcff2d1037dc6f42a613a8b526760a503ece29f72b2da3368abedfe58f20342a550ef8bab06557c7d330605f3e256a9580fc9fed889467fa715279ea7352
7
- data.tar.gz: 12f6eb6f0770930ad46a221f0bc05da1b608fd8136384793e6a8ebc3d06f58afb74977a1101ac44e4c0a43861d4902ced531aed079b93985e2fd0ee1963f8d3a
6
+ metadata.gz: 7192657abdb0d6235adee6872cabda56348bc38fcd4967c96979747cb31d99aedfe678f34733fe553ff2ac76fcd2d27121f6f36415948f3c77535b216348a86f
7
+ data.tar.gz: a0f8b7d10f012dc9f462aab72376edbe74f8a5d27d6257001dec7c77e0a30fdc04d0eb7f1f06103e80cd4437f39d05222c3dc6f9c2bb06a8e47c89adafbab45d
data/LICENSE CHANGED
@@ -1,27 +1,27 @@
1
- Copyright (c) 2014, Tommaso Barbugli
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
@@ -4,7 +4,11 @@ Stream Rails
4
4
  [![image](https://secure.travis-ci.org/GetStream/stream-rails.png?branch=master)](http://travis-ci.org/GetStream/stream-rails)
5
5
  [![Gem Version](https://badge.fury.io/rb/stream_rails.svg)](http://badge.fury.io/rb/stream_rails)
6
6
 
7
- This package helps you create activity streams & newsfeeds with Ruby on Rails and [GetStream.io](https://getstream.io).
7
+ [stream-rails](https://github.com/GetStream/stream-rails) is a Ruby on Rails client for [Stream](https://getstream.io/).
8
+
9
+ You can sign up for a Stream account at https://getstream.io/get_started.
10
+
11
+ Note there is also a lower level [Ruby - Stream integration](https://github.com/getstream/stream-ruby) library which is suitable for all Ruby applications.
8
12
 
9
13
  ### Activity Streams & Newsfeeds
10
14
 
@@ -72,10 +76,11 @@ Then you can add the StreamRails configuration in ```config/initializers/stream_
72
76
  require 'stream_rails'
73
77
 
74
78
  StreamRails.configure do |config|
75
- config.api_key = "YOUR API KEY"
76
- config.api_secret = "YOUR API SECRET"
77
- config.timeout = 30 # Optional, defaults to 3
78
- config.location = 'us-east' # Optional, defaults to 'us-east'
79
+ config.api_key = "YOUR API KEY"
80
+ config.api_secret = "YOUR API SECRET"
81
+ config.timeout = 30 # Optional, defaults to 3
82
+ config.location = 'us-east' # Optional, defaults to 'us-east'
83
+ config.api_hostname = 'stream-io-api.com' # Optional, defaults to 'stream-io-api.com'
79
84
  # If you use custom feed names, e.g.: timeline_flat, timeline_aggregated,
80
85
  # use this, otherwise omit:
81
86
  config.news_feeds = { flat: "timeline_flat", aggregated: "timeline_aggregated" }
@@ -142,7 +147,7 @@ end
142
147
  ```
143
148
  Everytime a Pin is created it will be stored in the feed of the user that created it. When a Pin instance is deleted, the feed will be removed as well.
144
149
 
145
- ####Activity fields
150
+ #### Activity fields
146
151
 
147
152
  ActiveRecord models are stored in your feeds as activities; Activities are objects that tell the story of a person performing an action on or with an object, in its simplest form, an activity consists of an actor, a verb, and an object. In order for this to happen your models need to implement this methods:
148
153
 
@@ -171,7 +176,7 @@ class Pin < ActiveRecord::Base
171
176
  end
172
177
  ```
173
178
 
174
- ####Activity extra data
179
+ #### Activity extra data
175
180
 
176
181
  Often you'll want to store more data than just the basic fields. You achieve this by implementing ```#activity_extra_data``` in your model.
177
182
 
@@ -195,7 +200,7 @@ class Pin < ActiveRecord::Base
195
200
  end
196
201
  ```
197
202
 
198
- ####Activity creation
203
+ #### Activity creation
199
204
 
200
205
  If you want to control when to create an activity you should implement
201
206
  the ```#activity_should_sync?``` method in your model.
@@ -221,7 +226,7 @@ end
221
226
 
222
227
  This will create an activity only when `self.published` is true.
223
228
 
224
- ###Feed manager
229
+ ### Feed manager
225
230
 
226
231
  ```stream_rails``` comes with a Feed Manager class that helps with all common feed operations. You can get an instance of the manager with ```StreamRails.feed_manager```.
227
232
 
@@ -229,18 +234,18 @@ This will create an activity only when `self.published` is true.
229
234
  feed = StreamRails.feed_manager.get_user_feed(current_user.id)
230
235
  ```
231
236
 
232
- ####Feeds bundled with feed_manager
237
+ #### Feeds bundled with feed_manager
233
238
 
234
239
  To get you started the manager has 4 feeds pre-configured. You can add more feeds if your application requires it.
235
240
  Feeds are divided into three categories.
236
241
 
237
- #####User feed:
242
+ ##### User feed:
238
243
  The user feed stores all activities for a user. Think of it as your personal Facebook page. You can easily get this feed from the manager.
239
244
  ```ruby
240
245
  feed = StreamRails.feed_manager.get_user_feed(current_user.id)
241
246
  ```
242
247
 
243
- #####News feeds:
248
+ ##### News feeds:
244
249
  News feeds store activities from the people you follow.
245
250
  There is both a flat newsfeed (similar to twitter) and an aggregated newsfeed (like facebook).
246
251
 
@@ -249,7 +254,7 @@ feed = StreamRails.feed_manager.get_news_feeds(current_user.id)[:flat]
249
254
  aggregated_feed = StreamRails.feed_manager.get_news_feeds(current_user.id)[:aggregated]
250
255
  ```
251
256
 
252
- #####Notification feed:
257
+ ##### Notification feed:
253
258
  The notification feed can be used to build notification functionality.
254
259
 
255
260
  ![Notification feed](http://feedly.readthedocs.org/en/latest/_images/fb_notification_system.png)
@@ -306,7 +311,7 @@ class Follow < ActiveRecord::Base
306
311
  end
307
312
  ```
308
313
 
309
- ####Follow a feed
314
+ #### Follow a feed
310
315
 
311
316
  In order to populate newsfeeds, you need to notify the system about follow relationships.
312
317
 
@@ -328,7 +333,7 @@ When you read data from feeds, a pin activity will look like this:
328
333
  {"actor": "User:1", "verb": "like", "object": "Item:42"}
329
334
  ```
330
335
 
331
- This is far from ready for usage in your template. We call the process of loading the references from the database
336
+ This is far from ready for usage in your template. We call the process of loading the references from the database
332
337
  enrichment. An example is shown below:
333
338
 
334
339
  ```ruby
@@ -339,7 +344,7 @@ results = feed.get()['results']
339
344
  activities = enricher.enrich_activities(results)
340
345
  ```
341
346
 
342
- If you have additional metadata in your activity (by overriding `activity_extra_data` in the class where you add the
347
+ If you have additional metadata in your activity (by overriding `activity_extra_data` in the class where you add the
343
348
  Stream Activity mixin), you can also enrich that field's data by doing the following:
344
349
 
345
350
  Step One: override the `activity_extra_data` method from our mixin:
@@ -361,9 +366,9 @@ class Pin < ActiveRecord::Base
361
366
  end
362
367
  ```
363
368
 
364
- Now we'll create a 'pin' object which has a `location` metadata field. In this example, we will also have a
365
- `location` table and model, and we set up our metadata in the `extra_data` field. It is important that the
366
- symbol of the metadata as well as the value of the meta data match this pattern. The left half of the
369
+ Now we'll create a 'pin' object which has a `location` metadata field. In this example, we will also have a
370
+ `location` table and model, and we set up our metadata in the `extra_data` field. It is important that the
371
+ symbol of the metadata as well as the value of the meta data match this pattern. The left half of the
367
372
  `string:string` metadata value when split on `:` must also match the name of the model.
368
373
 
369
374
  We must also tell the enricher to also fetch locations when looking through our activities
@@ -432,7 +437,7 @@ e.g. renders the activity partial using the `notifications` partial root, which
432
437
  <%= render_activity activity, :partial_root => "notifications" %>
433
438
  ```
434
439
 
435
- ####Pagination
440
+ #### Pagination
436
441
 
437
442
  For simple pagination you can use the [stream-ruby API](https://github.com/getstream/stream-ruby),
438
443
  as follows in your controller:
@@ -452,10 +457,20 @@ require 'stream_rails'
452
457
  StreamRails.enabled = false
453
458
  ```
454
459
 
455
- ###Running specs
460
+ ### Running specs
456
461
 
457
462
  From the project root directory:
458
463
 
459
464
  ```
460
465
  ./bin/run_tests.sh
461
466
  ```
467
+
468
+ ### Full documentation and Low level APIs access
469
+
470
+ When needed you can also use the [low level Ruby API](https://github.com/getstream/stream-ruby) directly. Documentation is available at the [Stream website](https://getstream.io/docs/?language=ruby).
471
+
472
+ ### Copyright and License Information
473
+
474
+ Copyright (c) 2014-2017 Stream.io Inc, and individual contributors. All rights reserved.
475
+
476
+ See the file "LICENSE" for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.
@@ -4,6 +4,7 @@ module StreamRails
4
4
  attr_accessor :api_key
5
5
  attr_accessor :api_secret
6
6
  attr_accessor :location
7
+ attr_accessor :api_hostname
7
8
  attr_accessor :api_site_id
8
9
  attr_accessor :enabled
9
10
  attr_accessor :timeout
@@ -14,7 +15,7 @@ module StreamRails
14
15
 
15
16
  def initialize
16
17
  @enabled = true
17
- @news_feeds = { flat: 'flat', aggregated: 'aggregated' }
18
+ @news_feeds = { timeline: 'timeline', timeline_aggregated: 'timeline_aggregated' }
18
19
  @notification_feed = 'notification'
19
20
  @user_feed = 'user'
20
21
  @timeout = 3
@@ -1,3 +1,3 @@
1
1
  module StreamRails
2
- VERSION = '2.5.2'.freeze
2
+ VERSION = '2.6.0'.freeze
3
3
  end
data/lib/stream_rails.rb CHANGED
@@ -19,7 +19,8 @@ module StreamRails
19
19
  config.api_secret,
20
20
  config.api_site_id,
21
21
  location: config.location,
22
- default_timeout: config.timeout
22
+ default_timeout: config.timeout,
23
+ api_hostname: config.api_hostname
23
24
  )
24
25
  end
25
26
 
@@ -51,11 +52,12 @@ module StreamRails
51
52
  # All available options and their defaults are in the example below:
52
53
  # @example Initializer for Rails
53
54
  # StreamRails.configure do |config|
54
- # config.api_key = "key"
55
- # config.api_secret = "secret"
56
- # config.api_site_id = "42"
57
- # config.location = "us-east"
58
- # config.enabled = true
55
+ # config.api_key = "key"
56
+ # config.api_secret = "secret"
57
+ # config.api_site_id = "42"
58
+ # config.location = "us-east"
59
+ # config.api_hostname = "stream-io-api.com"
60
+ # config.enabled = true
59
61
  # end
60
62
  def self.configure(&_block)
61
63
  yield(config) if block_given?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stream_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.6.0
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-01-10 00:00:00.000000000 Z
12
+ date: 2018-02-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
178
  version: '0'
179
179
  requirements: []
180
180
  rubyforge_project:
181
- rubygems_version: 2.6.6
181
+ rubygems_version: 2.4.7
182
182
  signing_key:
183
183
  specification_version: 4
184
184
  summary: A gem that provides a client interface for getstream.io