stream_rails 2.6.5 → 2.6.6

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
  SHA256:
3
- metadata.gz: 8632db482312bf19ed0fcbd8b31273bd650e89132538ebe1bc2bafa358836798
4
- data.tar.gz: f6e2b65acfd12d715e828cd95cae7d8b81a1dd8b1d9dafd9af637a33a2714852
3
+ metadata.gz: 32133621350213716900e311c9d4b9b5321f4b9de8c5743826baf986437f5f86
4
+ data.tar.gz: c3150a813bb1633373ccd4e10cef820d251095fc6f2885568b36d63cc4e0dd62
5
5
  SHA512:
6
- metadata.gz: ebd86a7f5b9249d2198c9c29f0afeec2d74c2710ed2e58f8ddae6062e69e975462cffe2dbe64206f87a079c83789af1adcbfb2bf1a917f393ef0c82a71ce62e8
7
- data.tar.gz: 143c831391eb0707578e2ad8178f97ff855c309d574b6ac10dda701995487a362b1f336d2a09c78b1c792b9ee6d9fb6a8b466b941ab6a3141a6590626402fdc1
6
+ metadata.gz: 0bde40e704677f17be82ad11c7a0c7e7db9749692e5a3e8b3f91b8416c1304d4d154ce4d9caf39f03b72eb4fe871cb4a0fdbf08f8f97bfba3138610ea6b4233e
7
+ data.tar.gz: 8445326c9e9fd66e3fda414b4430bbadf28ef340e3b1b98dfcf8d39c2f882844cc880c4907f04055810043acf921ef7308471a34743d63b20426573d63a5c327
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- Stream Rails
2
- ============
1
+ # Stream Rails
3
2
 
4
3
  [![image](https://secure.travis-ci.org/GetStream/stream-rails.png?branch=master)](http://travis-ci.org/GetStream/stream-rails)
5
4
  [![Gem Version](https://badge.fury.io/rb/stream_rails.svg)](http://badge.fury.io/rb/stream_rails)
@@ -16,11 +15,11 @@ Note there is also a lower level [Ruby - Stream integration](https://github.com/
16
15
 
17
16
  What you can build:
18
17
 
19
- * Activity streams such as seen on Github
20
- * A twitter style newsfeed
21
- * A feed like instagram/ pinterest
22
- * Facebook style newsfeeds
23
- * A notification system
18
+ - Activity streams such as seen on Github
19
+ - A twitter style newsfeed
20
+ - A feed like instagram/ pinterest
21
+ - Facebook style newsfeeds
22
+ - A notification system
24
23
 
25
24
  ### Demo
26
25
 
@@ -54,7 +53,7 @@ You can check out our example app built using this library on Github [https://gi
54
53
 
55
54
  ### Gem installation
56
55
 
57
- You can install ```stream_rails``` as you would any other gem:
56
+ You can install `stream_rails` as you would any other gem:
58
57
 
59
58
  ```
60
59
  gem install stream_rails
@@ -67,7 +66,7 @@ gem 'stream_rails'
67
66
  ```
68
67
 
69
68
  This library is tested against and fully supports the following Rails versions:
70
- - 3.x
69
+
71
70
  - 4.0
72
71
  - 4.2
73
72
  - 5.0
@@ -75,9 +74,9 @@ This library is tested against and fully supports the following Rails versions:
75
74
 
76
75
  ### Setup
77
76
 
78
- Login with Github on getstream.io and get your ```api_key``` and ```api_secret``` from your app configuration (Dashboard screen).
77
+ Login with Github on getstream.io and get your `api_key` and `api_secret` from your app configuration (Dashboard screen).
79
78
 
80
- Then you can add the StreamRails configuration in ```config/initializers/stream_rails.rb```
79
+ Then you can add the StreamRails configuration in `config/initializers/stream_rails.rb`
81
80
 
82
81
  ```ruby
83
82
  require 'stream_rails'
@@ -87,7 +86,7 @@ StreamRails.configure do |config|
87
86
  config.api_secret = "YOUR API SECRET"
88
87
  config.timeout = 30 # Optional, defaults to 3
89
88
  config.location = 'us-east' # Optional, defaults to 'us-east'
90
- config.api_hostname = 'stream-io-api.com' # Optional, defaults to 'stream-io-api.com'
89
+ config.api_hostname = 'stream-io-api.com' # Optional, defaults to 'stream-io-api.com'
91
90
  # If you use custom feed names, e.g.: timeline_flat, timeline_aggregated,
92
91
  # use this, otherwise omit:
93
92
  config.news_feeds = { flat: "timeline_flat", aggregated: "timeline_aggregated" }
@@ -152,14 +151,15 @@ class Pin < ActiveRecord::Base
152
151
 
153
152
  end
154
153
  ```
155
- 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.
154
+
155
+ 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.
156
156
 
157
157
  #### Activity fields
158
158
 
159
159
  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:
160
160
 
161
161
  **#activity_object** the object of the activity (eg. an AR model instance)
162
- **#activity_actor** the actor performing the activity (defaults to ```self.user```)
162
+ **#activity_actor** the actor performing the activity (defaults to `self.user`)
163
163
  **#activity_verb** the string representation of the verb (defaults to model class name)
164
164
 
165
165
  Here's a more complete example of the Pin class:
@@ -185,8 +185,7 @@ end
185
185
 
186
186
  #### Activity extra data
187
187
 
188
- Often you'll want to store more data than just the basic fields. You achieve this by implementing ```#activity_extra_data``` in your model.
189
-
188
+ Often you'll want to store more data than just the basic fields. You achieve this by implementing `#activity_extra_data` in your model.
190
189
 
191
190
  ```ruby
192
191
  class Pin < ActiveRecord::Base
@@ -210,7 +209,7 @@ end
210
209
  #### Activity creation
211
210
 
212
211
  If you want to control when to create an activity you should implement
213
- the ```#activity_should_sync?``` method in your model.
212
+ the `#activity_should_sync?` method in your model.
214
213
 
215
214
  ```ruby
216
215
  class Pin < ActiveRecord::Base
@@ -235,7 +234,7 @@ This will create an activity only when `self.published` is true.
235
234
 
236
235
  ### Feed manager
237
236
 
238
- ```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```.
237
+ `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`.
239
238
 
240
239
  ```ruby
241
240
  feed = StreamRails.feed_manager.get_user_feed(current_user.id)
@@ -247,12 +246,15 @@ To get you started the manager has 4 feeds pre-configured. You can add more feed
247
246
  Feeds are divided into three categories.
248
247
 
249
248
  ##### User feed:
249
+
250
250
  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.
251
+
251
252
  ```ruby
252
253
  feed = StreamRails.feed_manager.get_user_feed(current_user.id)
253
254
  ```
254
255
 
255
256
  ##### News feeds:
257
+
256
258
  News feeds store activities from the people you follow.
257
259
  There is both a flat newsfeed (similar to twitter) and an aggregated newsfeed (like facebook).
258
260
 
@@ -262,15 +264,18 @@ aggregated_feed = StreamRails.feed_manager.get_news_feeds(current_user.id)[:aggr
262
264
  ```
263
265
 
264
266
  ##### Notification feed:
267
+
265
268
  The notification feed can be used to build notification functionality.
266
269
 
267
270
  ![Notification feed](http://feedly.readthedocs.org/en/latest/_images/fb_notification_system.png)
268
271
 
269
272
  Below we show an example of how you can read the notification feed.
273
+
270
274
  ```ruby
271
275
  notification_feed = StreamRails.feed_manager.get_notification_feed(current_user.id)
272
276
 
273
277
  ```
278
+
274
279
  By default the notification feed will be empty. You can specify which users to notify when your model gets created. In the case of a retweet you probably want to notify the user of the parent tweet.
275
280
 
276
281
  ```ruby
@@ -337,7 +342,7 @@ StreamRails.feed_manager.follow_user(user_id, target_id)
337
342
  When you read data from feeds, a pin activity will look like this:
338
343
 
339
344
  ```json
340
- {"actor": "User:1", "verb": "like", "object": "Item:42"}
345
+ { "actor": "User:1", "verb": "like", "object": "Item:42" }
341
346
  ```
342
347
 
343
348
  This is far from ready for usage in your template. We call the process of loading the references from the database
@@ -350,7 +355,9 @@ feed = StreamRails.feed_manager.get_news_feeds(current_user.id)[:flat]
350
355
  results = feed.get()['results']
351
356
  activities = enricher.enrich_activities(results)
352
357
  ```
358
+
353
359
  A similar method called enrich_aggregated_activities is available for aggregated feeds.
360
+
354
361
  ```ruby
355
362
  enricher = StreamRails::Enrich.new
356
363
 
@@ -363,6 +370,7 @@ If you have additional metadata in your activity (by overriding `activity_extra_
363
370
  Stream Activity mixin), you can also enrich that field's data by doing the following:
364
371
 
365
372
  Step One: override the `activity_extra_data` method from our mixin:
373
+
366
374
  ```ruby
367
375
  class Pin < ActiveRecord::Base
368
376
  include StreamRails::Activity
@@ -403,6 +411,7 @@ pin.extra_data = {:location => "location:#{boulder.id}"}
403
411
 
404
412
  When we retrieve the activity later, the enrichment process will include our `location` model as well, giving us
405
413
  access to attributes and methods of the location model:
414
+
406
415
  ```ruby
407
416
  place = activity[:location].name
408
417
  # Boulder, CO
@@ -423,18 +432,17 @@ For convenience we include a basic view:
423
432
  </div>
424
433
  ```
425
434
 
426
- The ```render_activity``` view helper will render the activity by picking the partial ```activity/_pin``` for a pin activity, ```aggregated_activity/_follow``` for an aggregated activity with verb follow.
427
-
428
- The helper will automatically send ```activity``` to the local scope of the partial; additional parameters can be send as well as use different layouts, and prefix the name
435
+ The `render_activity` view helper will render the activity by picking the partial `activity/_pin` for a pin activity, `aggregated_activity/_follow` for an aggregated activity with verb follow.
429
436
 
437
+ The helper will automatically send `activity` to the local scope of the partial; additional parameters can be send as well as use different layouts, and prefix the name
430
438
 
431
- e.g. renders the activity partial using the ```small_activity``` layout:
439
+ e.g. renders the activity partial using the `small_activity` layout:
432
440
 
433
441
  ```
434
442
  <%= render_activity activity, :layout => "small_activity" %>
435
443
  ```
436
444
 
437
- e.g. prefixes the name of the template with "notification_":
445
+ e.g. prefixes the name of the template with "notification\_":
438
446
 
439
447
  ```
440
448
  <%= render_activity activity, :prefix => "notification_" %>
@@ -93,9 +93,9 @@ module StreamRails
93
93
  target: activity_target_id,
94
94
  time: activity_time
95
95
  }
96
- activity[:to] = activity_notify.map(&:id) unless activity_notify.nil?
97
- activity.merge!(activity_extra_data) if activity_extra_data != nil
98
- activity
96
+ arr = activity_notify
97
+ activity[:to] = arr.map(&:id) unless arr.nil?
98
+ activity.merge!(activity_extra_data || {})
99
99
  end
100
100
  end
101
101
  end
@@ -1,3 +1,3 @@
1
1
  module StreamRails
2
- VERSION = '2.6.5'.freeze
2
+ VERSION = '2.6.6'.freeze
3
3
  end
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.6.5
4
+ version: 2.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommaso Barbugli
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-08-06 00:00:00.000000000 Z
13
+ date: 2019-03-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionpack
@@ -46,20 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '2.6'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 2.6.1
49
+ version: '3.1'
53
50
  type: :runtime
54
51
  prerelease: false
55
52
  version_requirements: !ruby/object:Gem::Requirement
56
53
  requirements:
57
54
  - - "~>"
58
55
  - !ruby/object:Gem::Version
59
- version: '2.6'
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 2.6.1
56
+ version: '3.1'
63
57
  - !ruby/object:Gem::Dependency
64
58
  name: activerecord
65
59
  requirement: !ruby/object:Gem::Requirement
@@ -92,58 +86,58 @@ dependencies:
92
86
  name: sqlite3
93
87
  requirement: !ruby/object:Gem::Requirement
94
88
  requirements:
95
- - - ">="
89
+ - - "~>"
96
90
  - !ruby/object:Gem::Version
97
- version: '0'
91
+ version: 1.3.13
98
92
  type: :development
99
93
  prerelease: false
100
94
  version_requirements: !ruby/object:Gem::Requirement
101
95
  requirements:
102
- - - ">="
96
+ - - "~>"
103
97
  - !ruby/object:Gem::Version
104
- version: '0'
98
+ version: 1.3.13
105
99
  - !ruby/object:Gem::Dependency
106
100
  name: rspec
107
101
  requirement: !ruby/object:Gem::Requirement
108
102
  requirements:
109
103
  - - "~>"
110
104
  - !ruby/object:Gem::Version
111
- version: '2.10'
105
+ version: '3.8'
112
106
  type: :development
113
107
  prerelease: false
114
108
  version_requirements: !ruby/object:Gem::Requirement
115
109
  requirements:
116
110
  - - "~>"
117
111
  - !ruby/object:Gem::Version
118
- version: '2.10'
112
+ version: '3.8'
119
113
  - !ruby/object:Gem::Dependency
120
114
  name: simplecov
121
115
  requirement: !ruby/object:Gem::Requirement
122
116
  requirements:
123
117
  - - "~>"
124
118
  - !ruby/object:Gem::Version
125
- version: 0.7.1
119
+ version: 0.16.1
126
120
  type: :development
127
121
  prerelease: false
128
122
  version_requirements: !ruby/object:Gem::Requirement
129
123
  requirements:
130
124
  - - "~>"
131
125
  - !ruby/object:Gem::Version
132
- version: 0.7.1
126
+ version: 0.16.1
133
127
  - !ruby/object:Gem::Dependency
134
128
  name: sequel
135
129
  requirement: !ruby/object:Gem::Requirement
136
130
  requirements:
137
131
  - - "~>"
138
132
  - !ruby/object:Gem::Version
139
- version: '4.29'
133
+ version: '4.49'
140
134
  type: :development
141
135
  prerelease: false
142
136
  version_requirements: !ruby/object:Gem::Requirement
143
137
  requirements:
144
138
  - - "~>"
145
139
  - !ruby/object:Gem::Version
146
- version: '4.29'
140
+ version: '4.49'
147
141
  description:
148
142
  email: support@getstream.io
149
143
  executables: []
@@ -185,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
179
  version: '0'
186
180
  requirements: []
187
181
  rubyforge_project:
188
- rubygems_version: 2.7.3
182
+ rubygems_version: 2.7.8
189
183
  signing_key:
190
184
  specification_version: 4
191
185
  summary: A gem that provides a client interface for getstream.io