livefyre 1.3.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +3 -6
- data/CHANGELOG +10 -0
- data/README.md +3 -66
- data/circle.yml +10 -0
- data/lib/livefyre.rb +1 -1
- data/lib/livefyre/api/domain.rb +15 -0
- data/lib/livefyre/api/personalized_stream.rb +79 -72
- data/lib/livefyre/core/collection.rb +93 -0
- data/lib/livefyre/core/network.rb +61 -56
- data/lib/livefyre/core/site.rb +34 -82
- data/lib/livefyre/cursor/timeline_cursor.rb +45 -0
- data/lib/livefyre/{entity → dto}/subscription.rb +12 -14
- data/lib/livefyre/{entity → dto}/topic.rb +16 -13
- data/lib/livefyre/exceptions/api_exception.rb +29 -0
- data/lib/livefyre/exceptions/livefyre_exception.rb +9 -0
- data/lib/livefyre/factory/cursor_factory.rb +4 -4
- data/lib/livefyre/model/collection_data.rb +30 -0
- data/lib/livefyre/model/cursor_data.rb +17 -0
- data/lib/livefyre/model/network_data.rb +10 -0
- data/lib/livefyre/model/site_data.rb +10 -0
- data/lib/livefyre/type/collection_type.rb +11 -0
- data/lib/livefyre/type/subscription_type.rb +5 -0
- data/lib/livefyre/utils/livefyre_util.rb +24 -0
- data/lib/livefyre/validator/collection_validator.rb +33 -0
- data/lib/livefyre/validator/cursor_validator.rb +15 -0
- data/lib/livefyre/validator/network_validator.rb +19 -0
- data/lib/livefyre/validator/site_validator.rb +14 -0
- data/lib/livefyre/version.rb +1 -1
- data/livefyre.gemspec +15 -12
- data/spec/livefyre/api/domain_spec.rb +40 -0
- data/spec/livefyre/api/personalized_stream_spec.rb +54 -37
- data/spec/livefyre/core/collection_spec.rb +90 -0
- data/spec/livefyre/core/network_spec.rb +32 -6
- data/spec/livefyre/core/site_spec.rb +24 -62
- data/spec/livefyre/cursor/timeline_cursor_spec.rb +25 -0
- data/spec/livefyre/dto/subscription_spec.rb +27 -0
- data/spec/livefyre/dto/topic_spec.rb +35 -0
- data/spec/livefyre/factory/cursor_factory_spec.rb +29 -0
- data/spec/livefyre/utils/utils_spec.rb +30 -0
- data/spec/spec_helper.rb +34 -0
- metadata +134 -72
- data/.idea/misc.xml +0 -5
- data/.idea/modules.xml +0 -9
- data/lib/livefyre/entity/timeline_cursor.rb +0 -41
- data/spec/livefyre/test_spec.rb +0 -7
@@ -1,7 +1,11 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Livefyre
|
2
4
|
class Topic
|
3
5
|
TOPIC_IDENTIFIER = ':topic='
|
4
6
|
|
7
|
+
attr_accessor :id, :label, :created_at, :modified_at
|
8
|
+
|
5
9
|
def initialize(id, label, created_at=nil, modified_at=nil)
|
6
10
|
@id = id
|
7
11
|
@label = label
|
@@ -9,38 +13,37 @@ module Livefyre
|
|
9
13
|
@modified_at = modified_at
|
10
14
|
end
|
11
15
|
|
12
|
-
attr_reader :id
|
13
|
-
attr_reader :label
|
14
|
-
attr_reader :created_at
|
15
|
-
attr_reader :modified_at
|
16
|
-
|
17
16
|
def self.create(core, id, label)
|
18
17
|
new(Topic::generate_urn(core, id), label)
|
19
18
|
end
|
20
19
|
|
20
|
+
def to_json(options = {})
|
21
|
+
to_hash.to_json(options)
|
22
|
+
end
|
23
|
+
|
21
24
|
def self.serialize_from_json(json)
|
22
25
|
new(json['id'], json['label'], json['createdAt'], json['modifiedAt'])
|
23
26
|
end
|
24
27
|
|
25
|
-
def
|
26
|
-
|
28
|
+
def to_hash
|
29
|
+
hash = { :id => @id, :label => @label }
|
27
30
|
if @created_at != nil
|
28
|
-
|
31
|
+
hash[:createdAt] = @created_at
|
29
32
|
end
|
30
33
|
|
31
34
|
if @modified_at != nil
|
32
|
-
|
35
|
+
hash[:modifiedAt] = @modified_at
|
33
36
|
end
|
34
37
|
|
35
|
-
|
38
|
+
hash
|
36
39
|
end
|
37
40
|
|
38
41
|
def self.generate_urn(core, id)
|
39
|
-
"#{core.
|
42
|
+
"#{core.urn}#{TOPIC_IDENTIFIER}#{id}"
|
40
43
|
end
|
41
44
|
|
42
|
-
def
|
43
|
-
@id[@id.index(TOPIC_IDENTIFIER) + TOPIC_IDENTIFIER.length]
|
45
|
+
def truncated_id
|
46
|
+
@id[@id.index(TOPIC_IDENTIFIER) + TOPIC_IDENTIFIER.length..-1]
|
44
47
|
end
|
45
48
|
end
|
46
49
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'livefyre/exceptions/livefyre_exception'
|
2
|
+
|
3
|
+
module Livefyre
|
4
|
+
class ApiException < LivefyreException
|
5
|
+
attr_reader :object
|
6
|
+
|
7
|
+
def initialize(object, status_code)
|
8
|
+
message = ApiStatus::get_message(status_code)
|
9
|
+
|
10
|
+
super(message)
|
11
|
+
@object = object
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module ApiStatus
|
16
|
+
STATUS_MAP = {400 => 'Please check the contents of your request. Error code 400.',
|
17
|
+
401 => 'The request requires authentication via an HTTP Authorization header. Error code 401.',
|
18
|
+
403 => 'The server understood the request, but is refusing to fulfill it. Error code 403.',
|
19
|
+
404 => 'The requested resource was not found. Error code 404.',
|
20
|
+
500 => 'Livefyre appears to be down. Please see status.livefyre.com or contact us for more information. Error code 500.',
|
21
|
+
501 => 'The requested functionality is not currently supported. Error code 501.',
|
22
|
+
502 => 'The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request at this time. Error code 502.',
|
23
|
+
503 => 'The service is undergoing scheduled maintenance, and will be available again shortly. Error code 503.'}
|
24
|
+
|
25
|
+
def self.get_message(code)
|
26
|
+
STATUS_MAP[code]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
require 'livefyre/
|
1
|
+
require 'livefyre/cursor/timeline_cursor'
|
2
2
|
|
3
3
|
module Livefyre
|
4
4
|
class CursorFactory
|
5
5
|
def self.get_topic_stream_cursor(core, topic, limit=50, date=Time.new)
|
6
6
|
resource = "#{topic.id}:topicStream"
|
7
|
-
TimelineCursor
|
7
|
+
TimelineCursor::init(core, resource, limit, date)
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.get_personal_stream_cursor(network, user, limit=50, date=Time.new)
|
11
|
-
resource = "#{network.
|
12
|
-
TimelineCursor
|
11
|
+
resource = "#{network.get_urn_for_user(user)}:personalStream"
|
12
|
+
TimelineCursor::init(network, resource, limit, date)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'livefyre/exceptions/livefyre_exception'
|
2
|
+
|
3
|
+
module Livefyre
|
4
|
+
class CollectionData
|
5
|
+
attr_accessor :id, :type, :title, :article_id, :url, :tags, :topics, :extensions
|
6
|
+
|
7
|
+
def initialize(type, title, article_id, url)
|
8
|
+
@type = type
|
9
|
+
@title = title
|
10
|
+
@article_id = article_id
|
11
|
+
@url = url
|
12
|
+
end
|
13
|
+
|
14
|
+
def as_hash
|
15
|
+
hash = {}
|
16
|
+
self.instance_variables.each {|var| hash[var.to_s.delete('@')] = self.instance_variable_get(var) }
|
17
|
+
hash['articleId'] = @article_id
|
18
|
+
hash.delete('article_id')
|
19
|
+
hash.delete('id')
|
20
|
+
hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def id
|
24
|
+
if (defined?(@id)).nil?
|
25
|
+
raise LivefyreException, 'Call create_or_update on the collection to set the id.'
|
26
|
+
end
|
27
|
+
@id
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Livefyre
|
2
|
+
class CursorData
|
3
|
+
attr_accessor :resource, :limit, :cursor_time, :next, :previous
|
4
|
+
|
5
|
+
def initialize(resource, limit, start_time)
|
6
|
+
@resource = resource
|
7
|
+
@limit = limit
|
8
|
+
@cursor_time = start_time.utc.iso8601(3)
|
9
|
+
@next = false
|
10
|
+
@previous = false
|
11
|
+
end
|
12
|
+
|
13
|
+
def set_cursor_time(date)
|
14
|
+
@cursor_time = date.utc.iso8601(3)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'addressable/uri'
|
2
|
+
|
3
|
+
module Livefyre
|
4
|
+
class LivefyreUtil
|
5
|
+
def self.uri?(string)
|
6
|
+
uri = Addressable::URI.parse(string)
|
7
|
+
%w( ftp ftps http https ).include?(uri.scheme)
|
8
|
+
rescue Addressable::URI::BadURIError
|
9
|
+
false
|
10
|
+
rescue Addressable::URI::InvalidURIError
|
11
|
+
false
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get_network_from_core(core)
|
15
|
+
if core.class.name == 'Livefyre::Collection'
|
16
|
+
return core.site.network
|
17
|
+
elsif core.class.name == 'Livefyre::Site'
|
18
|
+
return core.network
|
19
|
+
else
|
20
|
+
return core
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'livefyre/utils/livefyre_util'
|
2
|
+
|
3
|
+
module Livefyre
|
4
|
+
class CollectionValidator
|
5
|
+
def self.validate(data)
|
6
|
+
reason = ''
|
7
|
+
|
8
|
+
reason += '\n Article id is null or blank' if data.article_id.to_s.empty?
|
9
|
+
|
10
|
+
if data.title.to_s.empty?
|
11
|
+
reason += '\n Title is null or blank'
|
12
|
+
elsif data.title.length > 255
|
13
|
+
reason += '\n Title is longer than 255 characters.'
|
14
|
+
end
|
15
|
+
|
16
|
+
if data.url.to_s.empty?
|
17
|
+
reason += '\n URL is null or blank.'
|
18
|
+
elsif !LivefyreUtil::uri?(data.url)
|
19
|
+
reason += '\n URL is not a valid url. see http://www.ietf.org/rfc/rfc2396.txt'
|
20
|
+
end
|
21
|
+
|
22
|
+
if data.type == nil
|
23
|
+
reason += '\n Type cannot be nil.'
|
24
|
+
elsif not CollectionType.const_defined?(data.type.start_with?('live') ? data.type.sub('live', '').upcase : data.type.upcase)
|
25
|
+
reason += '\n Type must be of valid, recognized type. See CollectionType.'
|
26
|
+
end
|
27
|
+
|
28
|
+
raise ArgumentError, "Problems with your collection input: #{reason}" if reason.length > 0
|
29
|
+
|
30
|
+
data
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Livefyre
|
2
|
+
class CursorValidator
|
3
|
+
def self.validate(data)
|
4
|
+
reason = ''
|
5
|
+
|
6
|
+
reason += '\n Resource is null or blank' if data.resource.to_s.empty?
|
7
|
+
reason += '\n Limit is null or blank' if data.limit.to_s.empty?
|
8
|
+
reason += '\n Cursor time is null or blank' if data.cursor_time.to_s.empty?
|
9
|
+
|
10
|
+
raise ArgumentError, "Problems with your cursor input: #{reason}" if reason.length > 0
|
11
|
+
|
12
|
+
data
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Livefyre
|
2
|
+
class NetworkValidator
|
3
|
+
def self.validate(data)
|
4
|
+
reason = ''
|
5
|
+
|
6
|
+
if data.name.to_s.empty?
|
7
|
+
reason += '\n Name is null or blank'
|
8
|
+
elsif !data.name.to_s.end_with? 'fyre.co'
|
9
|
+
reason += "\n Name must end with 'fyre.co'"
|
10
|
+
end
|
11
|
+
|
12
|
+
reason += '\n Key is null or blank' if data.key.to_s.empty?
|
13
|
+
|
14
|
+
raise ArgumentError, "Problems with your network input: #{reason}" if reason.length > 0
|
15
|
+
|
16
|
+
data
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Livefyre
|
2
|
+
class SiteValidator
|
3
|
+
def self.validate(data)
|
4
|
+
reason = ''
|
5
|
+
|
6
|
+
reason += '\n Id is null or blank.' if data.id.to_s.empty?
|
7
|
+
reason += '\n Key is null or blank.' if data.key.to_s.empty?
|
8
|
+
|
9
|
+
raise ArgumentError, "Problems with your site input: #{reason}" if reason.length > 0
|
10
|
+
|
11
|
+
data
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/livefyre/version.rb
CHANGED
data/livefyre.gemspec
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
require File.expand_path('../lib/livefyre/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
|
-
spec.name =
|
5
|
+
spec.name = 'livefyre'
|
6
6
|
spec.version = Livefyre::VERSION
|
7
|
-
spec.authors = [
|
8
|
-
spec.email = [
|
7
|
+
spec.authors = ['Livefyre']
|
8
|
+
spec.email = ['tools@livefyre.com']
|
9
9
|
spec.description = %q{Livefyre Ruby utility classes}
|
10
10
|
spec.summary = %q{Livefyre Ruby utility classes}
|
11
11
|
spec.post_install_message = <<-MESSAGE
|
@@ -13,18 +13,21 @@ Gem::Specification.new do |spec|
|
|
13
13
|
! Users that were using the previous livefyre gem (v.0.1.2) should now refer to livefyre-mashable.
|
14
14
|
! These two gems cannot be used in conjunction with one another as they share the same namespace.
|
15
15
|
MESSAGE
|
16
|
-
spec.homepage =
|
17
|
-
spec.license =
|
16
|
+
spec.homepage = 'http://github.com/livefyre/livefyre-ruby-utils'
|
17
|
+
spec.license = 'MIT'
|
18
18
|
|
19
19
|
spec.files = `git ls-files`.split($/)
|
20
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
21
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
|
-
spec.require_paths = [
|
22
|
+
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.
|
25
|
-
spec.
|
26
|
-
spec.
|
27
|
-
spec.
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
24
|
+
spec.add_runtime_dependency 'rake'
|
25
|
+
spec.add_runtime_dependency 'rest-client', '~> 1.7', '>= 1.7.2'
|
26
|
+
spec.add_runtime_dependency 'jwt', '~> 0.1', '>= 0.1.13'
|
27
|
+
spec.add_runtime_dependency 'addressable', '~> 2.3', '>= 2.3.6'
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.7', '>= 1.7.4'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.1', '>= 3.1'
|
30
|
+
spec.add_development_dependency 'coveralls', '~> 0.7.1'
|
31
|
+
spec.add_development_dependency 'simplecov', '~> 0.9.1'
|
32
|
+
|
30
33
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'livefyre'
|
3
|
+
require 'livefyre/api/domain'
|
4
|
+
require 'jwt'
|
5
|
+
|
6
|
+
include Livefyre
|
7
|
+
|
8
|
+
describe Livefyre::Domain do
|
9
|
+
before(:each) do
|
10
|
+
@network = Livefyre.get_network(NETWORK_NAME, NETWORK_KEY)
|
11
|
+
@site = @network.get_site(SITE_ID, SITE_KEY)
|
12
|
+
@collection = @site.build_comments_collection(TITLE, ARTICLE_ID, URL)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should correctly form quill URLs from core objects' do
|
16
|
+
quill_domain_ssl = "https://#{@network.network_name}.quill.fyre.co"
|
17
|
+
expect(Domain::quill(@network)).to eq(quill_domain_ssl)
|
18
|
+
expect(Domain::quill(@site)).to eq(quill_domain_ssl)
|
19
|
+
expect(Domain::quill(@collection)).to eq(quill_domain_ssl)
|
20
|
+
|
21
|
+
quill_domain = "http://quill.#{@network.network_name}.fyre.co"
|
22
|
+
@network.ssl = false
|
23
|
+
expect(Domain::quill(@network)).to eq(quill_domain)
|
24
|
+
expect(Domain::quill(@site)).to eq(quill_domain)
|
25
|
+
expect(Domain::quill(@collection)).to eq(quill_domain)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should correctly form bootstrap URLs from core objects' do
|
29
|
+
bootstrap_domain_ssl = "https://#{@network.network_name}.bootstrap.fyre.co"
|
30
|
+
expect(Domain::bootstrap(@network)).to eq(bootstrap_domain_ssl)
|
31
|
+
expect(Domain::bootstrap(@site)).to eq(bootstrap_domain_ssl)
|
32
|
+
expect(Domain::bootstrap(@collection)).to eq(bootstrap_domain_ssl)
|
33
|
+
|
34
|
+
bootstrap_domain = "http://bootstrap.#{@network.network_name}.fyre.co"
|
35
|
+
@network.ssl = false
|
36
|
+
expect(Domain::bootstrap(@network)).to eq(bootstrap_domain)
|
37
|
+
expect(Domain::bootstrap(@site)).to eq(bootstrap_domain)
|
38
|
+
expect(Domain::bootstrap(@collection)).to eq(bootstrap_domain)
|
39
|
+
end
|
40
|
+
end
|
@@ -1,65 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require 'livefyre'
|
2
3
|
require 'jwt'
|
3
4
|
require 'livefyre/api/personalized_stream'
|
4
5
|
require 'livefyre/factory/cursor_factory'
|
5
6
|
|
6
|
-
|
7
|
-
c.filter_run_excluding :broken => true
|
8
|
-
end
|
7
|
+
include Livefyre
|
9
8
|
|
10
|
-
describe Livefyre::
|
9
|
+
describe Livefyre::PersonalizedStream do
|
11
10
|
before(:each) do
|
12
11
|
@network = Livefyre.get_network(NETWORK_NAME, NETWORK_KEY)
|
13
12
|
@site = @network.get_site(SITE_ID, SITE_KEY)
|
14
13
|
end
|
15
14
|
|
16
|
-
it 'should
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
it 'should throw an exception if topic label does not fit the criteria' do
|
16
|
+
expect{ PersonalizedStream::create_or_update_topic(@network, 1, '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890') }.to raise_error(ArgumentError)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should test that personalized streams topic api work for networks' do
|
20
|
+
PersonalizedStream::create_or_update_topic(@network, 1, 'EINS')
|
21
|
+
topic = PersonalizedStream::get_topic(@network, 1)
|
22
|
+
expect(PersonalizedStream::delete_topic(@network, topic)).to be true
|
23
|
+
|
24
|
+
PersonalizedStream::create_or_update_topics(@network, {1 => 'EINS', 2 => 'ZWEI'})
|
25
|
+
topics = PersonalizedStream::get_topics(@network)
|
26
|
+
|
27
|
+
name = "RUBY PSSTREAM TEST #{Time.new}"
|
28
|
+
collection = @site.build_comments_collection(name, name, URL)
|
29
|
+
collection.data.topics = topics
|
30
|
+
collection.create_or_update
|
20
31
|
|
21
|
-
|
22
|
-
|
23
|
-
|
32
|
+
PersonalizedStream::delete_topics(@network, topics)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should test that personalized streams topic api work for sites' do
|
36
|
+
PersonalizedStream::create_or_update_topic(@site, 1, 'EINS')
|
37
|
+
topic = PersonalizedStream::get_topic(@site, 1)
|
38
|
+
expect(PersonalizedStream::delete_topic(@site, topic)).to be true
|
39
|
+
|
40
|
+
PersonalizedStream::create_or_update_topics(@site, {1 => 'EINS', 2 => 'ZWEI'})
|
41
|
+
topics = PersonalizedStream::get_topics(@site)
|
42
|
+
|
43
|
+
name = "RUBY PSSTREAM TEST #{Time.new}"
|
44
|
+
collection = @site.build_comments_collection(name, name, URL)
|
45
|
+
collection.data.topics = topics
|
46
|
+
collection.create_or_update
|
47
|
+
|
48
|
+
PersonalizedStream::delete_topics(@site, topics)
|
24
49
|
end
|
25
50
|
|
26
51
|
it 'should test that personalized streams api work for subscriptions' do
|
27
|
-
topics =
|
28
|
-
user_token = @network.build_user_auth_token(USER_ID, "#{USER_ID}@#{NETWORK_NAME}",
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
52
|
+
topics = PersonalizedStream::create_or_update_topics(@network, {1 => 'EINS', 2 => 'ZWEI'})
|
53
|
+
user_token = @network.build_user_auth_token(USER_ID, "#{USER_ID}@#{NETWORK_NAME}", Network::DEFAULT_EXPIRES)
|
54
|
+
|
55
|
+
PersonalizedStream::add_subscriptions(@network, user_token, topics)
|
56
|
+
PersonalizedStream::get_subscriptions(@network, USER_ID)
|
57
|
+
PersonalizedStream::replace_subscriptions(@network, user_token, [topics[1]])
|
58
|
+
PersonalizedStream::get_subscribers(@network, topics[1])
|
59
|
+
PersonalizedStream::remove_subscriptions(@network, user_token, [topics[1]])
|
35
60
|
end
|
36
61
|
|
37
62
|
it 'should test that personalized streams api work for timelines and cursors' do
|
38
|
-
topic =
|
39
|
-
cursor =
|
63
|
+
topic = PersonalizedStream::create_or_update_topic(@network, 1, 'EINS')
|
64
|
+
cursor = CursorFactory::get_topic_stream_cursor(@network, topic)
|
40
65
|
|
41
66
|
cursor.next
|
42
67
|
cursor.previous
|
43
68
|
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should test that personalized streams api work for topics' do
|
48
|
-
Livefyre::PersonalizedStream::create_or_update_topic(@site, 1, 'EINS')
|
49
|
-
topic = Livefyre::PersonalizedStream::get_topic(@site, 1)
|
50
|
-
Livefyre::PersonalizedStream::delete_topic(@site, topic).should == true
|
51
|
-
|
52
|
-
Livefyre::PersonalizedStream::create_or_update_topics(@site, {1 => 'EINS', 2 => 'ZWEI'})
|
53
|
-
topics = Livefyre::PersonalizedStream::get_topics(@site)
|
54
|
-
Livefyre::PersonalizedStream::delete_topics(@site, topics)
|
69
|
+
PersonalizedStream::delete_topic(@network, topic)
|
55
70
|
end
|
56
71
|
|
57
72
|
it 'should test that personalized streams api work for collections' do
|
58
|
-
topics =
|
73
|
+
topics = PersonalizedStream::create_or_update_topics(@site, {1 => 'EINS', 2 => 'ZWEI'})
|
74
|
+
name = "RUBY PSSTREAM TEST #{Time.new}"
|
75
|
+
collection = @site.build_comments_collection(name, name, URL).create_or_update
|
59
76
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
77
|
+
PersonalizedStream::add_collection_topics(collection, topics)
|
78
|
+
PersonalizedStream::get_collection_topics(collection)
|
79
|
+
PersonalizedStream::replace_collection_topics(collection, [topics[1]])
|
80
|
+
PersonalizedStream::remove_collection_topics(collection, [topics[1]])
|
64
81
|
end
|
65
82
|
end
|