stream-ruby 3.0.1 → 3.1.0

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: b1234ef10092da5e7ceade3115fc2036afee959883ab2ac22c96480106157f5b
4
- data.tar.gz: 6f5c5f1a2b91385f4497a9695a1cf018d216a5b737835aecfaddaada0c31dce8
3
+ metadata.gz: 05ce0c71f39cd30007d6dcd0672a1155c6ac917b5a37d851ee20d50eba9f08c0
4
+ data.tar.gz: 509f5e5c59cce2bfd309552defaa39b9ed69b6407c9a0e537f1c6fb1a01fe882
5
5
  SHA512:
6
- metadata.gz: 53793fe9fd892a88959ab38b62b1096d6f71b521e5ea7087a85354685dbaa857bb4f643863edb8281e7a187b0388810c7a2f972277de6fb4c63123339c06d46c
7
- data.tar.gz: 964cc5bad77573acb2a2c4e1856a910fdf5f2ed6ff12f565b1b7c864cecf64b15c1f00ef8c935a983906abadbe6d709867c1638bdf6ebd8341c253bded1495b3
6
+ metadata.gz: 0edd4f3150ba8b8f3bb25b62f18bfa55e9a7a90eee73641518a7cb134bc4b14639db033e5f70afb005d93e7dbfa1ad183f2a1676115af279022be0aa764bcaec
7
+ data.tar.gz: ef0007cfe4c1017f4e1cdd054b277fb51287cba6fc6a67fa5ec60fa06dfd0fd3c6f40f84ebee6d737a7eb603ae9528995bbcfe81ece28aadcd4becc86f4e339e
@@ -8,22 +8,21 @@ module Stream
8
8
  #
9
9
  # @return the found activities, if any.
10
10
  #
11
- # @example
11
+ # @example Retrieve by activity IDs
12
+ # @client.get_activities(
13
+ # ids: [
14
+ # '4b39fda2-d6e2-42c9-9abf-5301ef071b12',
15
+ # '89b910d3-1ef5-44f8-914e-e7735d79e817'
16
+ # ]
17
+ # )
12
18
  #
13
- #
14
- # @client.get_activities(
15
- # ids: [
16
- # '4b39fda2-d6e2-42c9-9abf-5301ef071b12',
17
- # '89b910d3-1ef5-44f8-914e-e7735d79e817'
18
- # ]
19
- # )
20
- #
21
- # @client.get_activities(
22
- # foreign_id_times: [
23
- # { foreign_id: 'post:1000', time: '2016-11-10T13:20:00.000000' },
24
- # { foreign_id: 'like:2000', time: '2018-01-07T09:15:59.123456' }
25
- # ]
26
- # )
19
+ # @example Retrieve by Foreign IDs + timestamps
20
+ # @client.get_activities(
21
+ # foreign_id_times: [
22
+ # { foreign_id: 'post:1000', time: '2016-11-10T13:20:00.000000' },
23
+ # { foreign_id: 'like:2000', time: '2018-01-07T09:15:59.123456' }
24
+ # ]
25
+ # )
27
26
  #
28
27
  def get_activities(params = {})
29
28
  if params[:foreign_id_times]
@@ -43,42 +42,108 @@ module Stream
43
42
  end
44
43
 
45
44
  #
46
- # Partial update activity, via foreign ID or Foreign ID + timestamp
45
+ # Partial update activity, via activity ID or Foreign ID + timestamp
47
46
  #
48
47
  # @param [Hash<:id, :foreign_id, :time, :set, :unset>] data the request params (id and foreign_id+timestamp mutually exclusive)
49
48
  #
50
49
  # @return the updated activity.
51
50
  #
52
- # @example
53
- #
54
- # @client.activity_partial_update(
55
- # id: "4b39fda2-d6e2-42c9-9abf-5301ef071b12",
56
- # set: {
57
- # "product.price.eur": 12.99,
58
- # "colors": {
59
- # "blue": "#0000ff",
60
- # "green": "#00ff00",
61
- # }
62
- # },
63
- # unset: [ "popularity", "size.xl" ]
64
- # )
65
- #
66
- # @client.activity_partial_update(
67
- # foreign_id: 'product:123',
68
- # time: '2016-11-10T13:20:00.000000',
69
- # set: {
70
- # "product.price.eur": 12.99,
71
- # "colors": {
72
- # "blue": "#0000ff",
73
- # "green": "#00ff00",
74
- # }
75
- # },
76
- # unset: [ "popularity", "size.xl" ]
77
- # )
51
+ # @example Identify using activity ID
52
+ # @client.activity_partial_update(
53
+ # id: "4b39fda2-d6e2-42c9-9abf-5301ef071b12",
54
+ # set: {
55
+ # "product.price.eur": 12.99,
56
+ # "colors": {
57
+ # "blue": "#0000ff",
58
+ # "green": "#00ff00",
59
+ # }
60
+ # },
61
+ # unset: [ "popularity", "size.xl" ]
62
+ # )
63
+ #
64
+ # @example Identify using Foreign ID + timestamp
65
+ # @client.activity_partial_update(
66
+ # foreign_id: 'product:123',
67
+ # time: '2016-11-10T13:20:00.000000',
68
+ # set: {
69
+ # "product.price.eur": 12.99,
70
+ # "colors": {
71
+ # "blue": "#0000ff",
72
+ # "green": "#00ff00",
73
+ # }
74
+ # },
75
+ # unset: [ "popularity", "size.xl" ]
76
+ # )
77
+ #
78
78
  def activity_partial_update(data = {})
79
79
  signature = Stream::Signer.create_jwt_token('activities', '*', @api_secret, '*')
80
80
  make_request(:post, '/activity/', signature, {}, data)
81
81
  end
82
82
 
83
+ #
84
+ # Batch partial activity update
85
+ #
86
+ # @param [Array< Hash<:id, :foreign_id, :time, :set, :unset> >] changes the list of changes to be applied
87
+ #
88
+ # @return the updated activities
89
+ #
90
+ # @example Identify using activity IDs
91
+ # @client.batch_activity_partial_update([
92
+ # {
93
+ # id: "4b39fda2-d6e2-42c9-9abf-5301ef071b12",
94
+ # set: {
95
+ # "product.price.eur": 12.99,
96
+ # "colors": {
97
+ # "blue": "#0000ff",
98
+ # "green": "#00ff00",
99
+ # }
100
+ # },
101
+ # unset: [ "popularity", "size.x2" ]
102
+ # },
103
+ # {
104
+ # id: "8d2dcad8-1e34-11e9-8b10-9cb6d0925edd",
105
+ # set: {
106
+ # "product.price.eur": 17.99,
107
+ # "colors": {
108
+ # "red": "#ff0000",
109
+ # "green": "#00ff00",
110
+ # }
111
+ # },
112
+ # unset: [ "rating" ]
113
+ # }
114
+ # ])
115
+ #
116
+ # @example Identify using Foreign IDs + timestamps
117
+ # @client.batch_activity_partial_update([
118
+ # {
119
+ # foreign_id: "product:123",
120
+ # time: '2016-11-10T13:20:00.000000',
121
+ # set: {
122
+ # "product.price.eur": 22.99,
123
+ # "colors": {
124
+ # "blue": "#0000ff",
125
+ # "green": "#00ff00",
126
+ # }
127
+ # },
128
+ # unset: [ "popularity", "size.x2" ]
129
+ # },
130
+ # {
131
+ # foreign_id: "product:1234",
132
+ # time: '2017-11-10T13:20:00.000000',
133
+ # set: {
134
+ # "product.price.eur": 37.99,
135
+ # "colors": {
136
+ # "black": "#000000",
137
+ # "white": "#ffffff",
138
+ # }
139
+ # },
140
+ # unset: [ "rating" ]
141
+ # }
142
+ # ])
143
+ #
144
+ def batch_activity_partial_update(changes = [])
145
+ signature = Stream::Signer.create_jwt_token('activities', '*', @api_secret, '*')
146
+ make_request(:post, '/activity/', signature, {}, {:changes => changes})
147
+ end
83
148
  end
84
149
  end
@@ -8,13 +8,11 @@ module Stream
8
8
  # @return [nil]
9
9
  #
10
10
  # @example
11
- #
12
- #
13
- # follows = [
14
- # {:source => 'flat:1', :target => 'user:1'},
15
- # {:source => 'flat:1', :target => 'user:3'}
16
- # ]
17
- # @client.follow_many(follows)
11
+ # follows = [
12
+ # {:source => 'flat:1', :target => 'user:1'},
13
+ # {:source => 'flat:1', :target => 'user:3'}
14
+ # ]
15
+ # @client.follow_many(follows)
18
16
  #
19
17
  def follow_many(follows, activity_copy_limit = nil)
20
18
  query_params = {}
@@ -33,13 +31,11 @@ module Stream
33
31
  # return [nil]
34
32
  #
35
33
  # @example
36
- #
37
- #
38
- # unfollows = [
39
- # {source: 'user:1', target: 'timeline:1'},
40
- # {source: 'user:2', target: 'timeline:2', keep_history: false}
41
- # ]
42
- # @client.unfollow_many(unfollows)
34
+ # unfollows = [
35
+ # {source: 'user:1', target: 'timeline:1'},
36
+ # {source: 'user:2', target: 'timeline:2', keep_history: false}
37
+ # ]
38
+ # @client.unfollow_many(unfollows)
43
39
  #
44
40
  def unfollow_many(unfollows)
45
41
  signature = Stream::Signer.create_jwt_token('follower', '*', @api_secret, '*')
@@ -143,7 +143,6 @@ module Stream
143
143
  def make_request(method, relative_url, signature, params = {}, data = {}, headers = {})
144
144
  headers['Authorization'] = signature
145
145
  headers['stream-auth-type'] = 'jwt'
146
-
147
146
  get_http_client.make_http_request(method, relative_url, make_query_params(params), data, headers)
148
147
  end
149
148
 
@@ -1,3 +1,3 @@
1
1
  module Stream
2
- VERSION = '3.0.1'.freeze
2
+ VERSION = '3.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stream-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.0
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-12-19 00:00:00.000000000 Z
13
+ date: 2019-01-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday