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
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'livefyre'
|
3
|
+
require 'jwt'
|
4
|
+
require 'livefyre/dto/topic'
|
5
|
+
require 'livefyre/exceptions/livefyre_exception'
|
6
|
+
|
7
|
+
include Livefyre
|
8
|
+
|
9
|
+
describe Livefyre::Collection do
|
10
|
+
before(:each) do
|
11
|
+
@site = Livefyre.get_network(NETWORK_NAME, NETWORK_KEY).get_site(SITE_ID, SITE_KEY)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should raise ArgumentError if article id, title, and/or url is blank' do
|
15
|
+
expect{ @site.build_comments_collection('', ARTICLE_ID, URL) }.to raise_error(ArgumentError)
|
16
|
+
expect{ @site.build_comments_collection(TITLE, '', URL) }.to raise_error(ArgumentError)
|
17
|
+
expect{ @site.build_comments_collection(TITLE, ARTICLE_ID, '') }.to raise_error(ArgumentError)
|
18
|
+
|
19
|
+
expect{ @site.build_collection(nil, nil, nil, nil) }.to raise_error(ArgumentError)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should raise ArgumentError if url is not a valid url for collection' do
|
23
|
+
expect{ @site.build_comments_collection(TITLE, ARTICLE_ID, 'blah.com/') }.to raise_error(ArgumentError)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should raise ArgumentError if title is more than 255 characters for collection' do
|
27
|
+
expect{ @site.build_comments_collection('1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456', ARTICLE_ID, URL) }.to raise_error(ArgumentError)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should raise ArgumentError if not a valid type is passed in when building a collection' do
|
31
|
+
expect{ @site.build_collection('bad_type', TITLE, ARTICLE_ID, URL) }.to raise_error(ArgumentError)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should check type and assign them to the correct field in the collection meta token' do
|
35
|
+
@token = @site.build_reviews_collection(TITLE, ARTICLE_ID, URL).build_collection_meta_token
|
36
|
+
@decoded = JWT.decode(@token, SITE_KEY)
|
37
|
+
|
38
|
+
expect(@decoded['type']).to eq('reviews')
|
39
|
+
|
40
|
+
@token = @site.build_blog_collection(TITLE, ARTICLE_ID, URL).build_collection_meta_token
|
41
|
+
@decoded = JWT.decode(@token, SITE_KEY)
|
42
|
+
|
43
|
+
expect(@decoded['type']).to eq('liveblog')
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should return a collection meta token' do
|
47
|
+
expect(@site.build_comments_collection(TITLE, ARTICLE_ID, URL).build_collection_meta_token).to be_truthy
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should return a valid checksum' do
|
51
|
+
collection = @site.build_comments_collection('title', 'articleId', 'http://livefyre.com')
|
52
|
+
collection.data.tags = 'tags'
|
53
|
+
expect(collection.build_checksum).to eq('8bcfca7fb2187b1dcb627506deceee32')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should test network_issued properly' do
|
57
|
+
collection = @site.build_comments_collection(TITLE, ARTICLE_ID, URL)
|
58
|
+
expect(collection.is_network_issued).to be false
|
59
|
+
|
60
|
+
topics = [ Topic.create(@site, 'ID', 'LABEL') ]
|
61
|
+
collection.data.topics = topics
|
62
|
+
expect(collection.is_network_issued).to be false
|
63
|
+
|
64
|
+
topics << Topic.create(@site.network, 'ID', 'LABEL')
|
65
|
+
expect(collection.is_network_issued).to be true
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should throw an error when trying to retrieve collection id when it is not set' do
|
69
|
+
collection = @site.build_comments_collection(TITLE, ARTICLE_ID, URL)
|
70
|
+
expect{ collection.data.id }.to raise_error(LivefyreException)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should product the correct urn for a collection' do
|
74
|
+
collection = @site.build_comments_collection(TITLE, ARTICLE_ID, URL)
|
75
|
+
collection.data.id = 1
|
76
|
+
expect(collection.urn).to eq("#{@site.urn}:collection=1")
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should test basic site api' do
|
80
|
+
name = "RubyCreateCollection#{Time.new}"
|
81
|
+
|
82
|
+
collection = @site.build_comments_collection(name, name, URL).create_or_update
|
83
|
+
content = collection.get_collection_content
|
84
|
+
|
85
|
+
collection.data.title+='super'
|
86
|
+
collection.create_or_update
|
87
|
+
|
88
|
+
expect(collection.data.id).to eq(content['collectionSettings']['collectionId'])
|
89
|
+
end
|
90
|
+
end
|
@@ -1,24 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require 'livefyre'
|
2
3
|
require 'jwt'
|
3
4
|
|
4
|
-
RSpec.configure do |c|
|
5
|
-
c.filter_run_excluding :broken => true
|
6
|
-
end
|
7
|
-
|
8
5
|
describe Livefyre::Network do
|
9
6
|
before(:each) do
|
10
7
|
@network = Livefyre.get_network(NETWORK_NAME, NETWORK_KEY)
|
11
8
|
end
|
12
9
|
|
10
|
+
it 'should raise ArgumentError if any param is nil' do
|
11
|
+
expect{ Livefyre.get_network(nil, nil) }.to raise_error(ArgumentError)
|
12
|
+
expect{ Livefyre.get_network('', NETWORK_KEY) }.to raise_error(ArgumentError)
|
13
|
+
expect{ Livefyre.get_network(NETWORK_NAME, '') }.to raise_error(ArgumentError)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should raise ArgumentError if network name does not end in fyre.co' do
|
17
|
+
expect{ Livefyre.get_network('some.network', '') }.to raise_error(ArgumentError)
|
18
|
+
end
|
19
|
+
|
13
20
|
it 'should raise ArgumentError if url_template does not contain {id}' do
|
14
21
|
expect{ @network.set_user_sync_url('blah.com/') }.to raise_error(ArgumentError)
|
15
22
|
end
|
16
23
|
|
17
24
|
it 'should raise ArgumentError if user_id is not alphanumeric' do
|
18
|
-
expect{ @network.build_user_auth_token('
|
25
|
+
expect{ @network.build_user_auth_token('fjoi@wje.1fj', 'test', 100) }.to raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should raise Argument Error if expires is not a number' do
|
29
|
+
expect{ @network.build_user_auth_token('abc', 'test', "100") }.to raise_error(ArgumentError)
|
19
30
|
end
|
20
31
|
|
21
32
|
it 'should validate a livefyre token' do
|
22
|
-
@network.validate_livefyre_token(@network.build_livefyre_token).
|
33
|
+
expect(@network.validate_livefyre_token(@network.build_livefyre_token)).to be true
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should verify the urn and user urn' do
|
37
|
+
urn = "urn:livefyre:#{@network.data.name}"
|
38
|
+
expect(@network.urn).to eq(urn)
|
39
|
+
expect(@network.get_urn_for_user(USER_ID)).to eq("#{urn}:user=#{USER_ID}")
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should get the correct network name' do
|
43
|
+
expect(@network.network_name).to eq(NETWORK_NAME.split('.')[0])
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should test network api calls' do
|
47
|
+
@network.set_user_sync_url(URL+'/{id}')
|
48
|
+
@network.sync_user('abc.ABC-123_huh')
|
23
49
|
end
|
24
50
|
end
|
@@ -1,73 +1,35 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'spec_helper'
|
3
2
|
require 'livefyre'
|
4
3
|
require 'jwt'
|
4
|
+
require 'livefyre/type/collection_type'
|
5
5
|
|
6
|
-
|
7
|
-
c.filter_run_excluding :broken => true
|
8
|
-
end
|
6
|
+
include Livefyre
|
9
7
|
|
10
8
|
describe Livefyre::Site do
|
11
9
|
before(:each) do
|
12
10
|
@site = Livefyre.get_network(NETWORK_NAME, NETWORK_KEY).get_site(SITE_ID, SITE_KEY)
|
13
11
|
end
|
14
12
|
|
15
|
-
it 'should
|
16
|
-
expect
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
expect(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
expect(@decoded['type']).to eq('liveblog')
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should return a collection meta token' do
|
40
|
-
expect{ @site.build_collection_meta_token('title', 'article_id', 'https://www.url.com', 'tags') }.to be_true
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should raise ArgumentError if url is not a valid url for checksum' do
|
44
|
-
expect{ @site.build_checksum('test', 'blah.com/', 'test') }.to raise_error(ArgumentError)
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should raise ArgumentError if title is more than 255 characters for checksum' do
|
48
|
-
expect{ @site.build_checksum('1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456', 'http://test.com', 'test') }.to raise_error(ArgumentError)
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'should return a valid checksum' do
|
52
|
-
expect(@site.build_checksum('title', 'https://www.url.com', 'tags')).to eq('4464458a10c305693b5bf4d43a384be7')
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should check for valid and invalid urls' do
|
56
|
-
expect{ @site.build_checksum('', 'test.com', '') }.to raise_error(ArgumentError)
|
57
|
-
|
58
|
-
@site.build_checksum('', 'http://localhost:8000', '')
|
59
|
-
@site.build_checksum('', 'http://清华大学.cn', '')
|
60
|
-
@site.build_checksum('', 'http://www.mysite.com/myresumé.html', '')
|
61
|
-
@site.build_checksum('', 'https://test.com/', '')
|
62
|
-
@site.build_checksum('', 'ftp://test.com/', '')
|
63
|
-
@site.build_checksum('', "https://test.com/path/test.-_~!$&'()*+,;=:@/dash", '')
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'should test basic site api', :broken => true do
|
67
|
-
@site.get_collection_content(ARTICLE_ID)
|
68
|
-
|
69
|
-
name = "RubyCreateCollection#{Time.new}"
|
70
|
-
id = @site.create_collection(name, name, 'http://answers.livefyre.com/RUBY')
|
71
|
-
expect(@site.get_collection_id(name)).to eq(id)
|
13
|
+
it 'should verify the urn' do
|
14
|
+
expect(@site.urn).to eq("#{@site.network.urn}:site=#{SITE_ID}")
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should create collections of all types and verify their type' do
|
18
|
+
collection = @site.build_comments_collection(TITLE, ARTICLE_ID, URL)
|
19
|
+
expect(collection.data.type).to eq(CollectionType::COMMENTS)
|
20
|
+
collection = @site.build_blog_collection(TITLE, ARTICLE_ID, URL)
|
21
|
+
expect(collection.data.type).to eq(CollectionType::BLOG)
|
22
|
+
collection = @site.build_chat_collection(TITLE, ARTICLE_ID, URL)
|
23
|
+
expect(collection.data.type).to eq(CollectionType::CHAT)
|
24
|
+
collection = @site.build_counting_collection(TITLE, ARTICLE_ID, URL)
|
25
|
+
expect(collection.data.type).to eq(CollectionType::COUNTING)
|
26
|
+
collection = @site.build_ratings_collection(TITLE, ARTICLE_ID, URL)
|
27
|
+
expect(collection.data.type).to eq(CollectionType::RATINGS)
|
28
|
+
collection = @site.build_reviews_collection(TITLE, ARTICLE_ID, URL)
|
29
|
+
expect(collection.data.type).to eq(CollectionType::REVIEWS)
|
30
|
+
collection = @site.build_sidenotes_collection(TITLE, ARTICLE_ID, URL)
|
31
|
+
expect(collection.data.type).to eq(CollectionType::SIDENOTES)
|
32
|
+
collection = @site.build_collection(CollectionType::COMMENTS, TITLE, ARTICLE_ID, URL)
|
33
|
+
expect(collection.data.type).to eq(CollectionType::COMMENTS)
|
72
34
|
end
|
73
35
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'livefyre'
|
3
|
+
require 'livefyre/cursor/timeline_cursor'
|
4
|
+
|
5
|
+
include Livefyre
|
6
|
+
|
7
|
+
describe Livefyre::TimelineCursor do
|
8
|
+
before(:each) do
|
9
|
+
@network = Livefyre.get_network(NETWORK_NAME, NETWORK_KEY)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should raise ArgumentError if any param is nil' do
|
13
|
+
expect{ TimelineCursor::init(@network, nil, nil, Time.new) }.to raise_error(ArgumentError)
|
14
|
+
expect{ TimelineCursor::init(@network, '', '', Time.new) }.to raise_error(ArgumentError)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should set the same cursor time' do
|
18
|
+
time = Time.new
|
19
|
+
|
20
|
+
cursor = TimelineCursor::init(@network, 'resource', 50, time)
|
21
|
+
set_time = cursor.data.cursor_time
|
22
|
+
cursor.data.set_cursor_time(time)
|
23
|
+
expect(cursor.data.cursor_time).to eq(set_time)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
require 'livefyre/dto/subscription'
|
4
|
+
|
5
|
+
include Livefyre
|
6
|
+
|
7
|
+
describe Livefyre::Subscription do
|
8
|
+
it 'should correctly form a hash' do
|
9
|
+
sub = Subscription.new('a', 'b', 'c')
|
10
|
+
h = sub.to_hash
|
11
|
+
expect(h[:to]).to eq('a')
|
12
|
+
expect(h[:by]).to eq('b')
|
13
|
+
expect(h[:type]).to eq('c')
|
14
|
+
expect(h.has_key?(:createdAt)).to be false
|
15
|
+
|
16
|
+
sub.created_at=0
|
17
|
+
h = sub.to_hash
|
18
|
+
expect(h[:createdAt]).to eq(0)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should produce the expected json and serialize from it' do
|
22
|
+
sub1 = Subscription.new('a', 'b', 'c')
|
23
|
+
json = sub1.to_json
|
24
|
+
sub2 = JSON.parse(json)
|
25
|
+
expect(sub1.to_hash).to eq(Subscription::serialize_from_json(sub2).to_hash)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
require 'livefyre/dto/topic'
|
4
|
+
require 'livefyre'
|
5
|
+
|
6
|
+
include Livefyre
|
7
|
+
|
8
|
+
describe Livefyre::Topic do
|
9
|
+
it 'should correctly form a hash' do
|
10
|
+
topic = Topic.new('a', 'b')
|
11
|
+
h = topic.to_hash
|
12
|
+
expect(h[:id]).to eq('a')
|
13
|
+
expect(h[:label]).to eq('b')
|
14
|
+
expect(h.has_key?(:createdAt)).to be false
|
15
|
+
expect(h.has_key?(:modifiedAt)).to be false
|
16
|
+
|
17
|
+
topic.created_at=0
|
18
|
+
topic.modified_at=1
|
19
|
+
h = topic.to_hash
|
20
|
+
expect(h[:createdAt]).to eq(0)
|
21
|
+
expect(h[:modifiedAt]).to eq(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should produce the expected json and serialize from it' do
|
25
|
+
topic = Topic.new('a', 'b', 0, 1)
|
26
|
+
json = topic.to_json
|
27
|
+
topic2 = JSON.parse(json)
|
28
|
+
expect(topic.to_hash).to eq(Topic::serialize_from_json(topic2).to_hash)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should retrieve the correct truncated id from a Topic' do
|
32
|
+
topic = Topic.create(Livefyre.get_network(NETWORK_NAME, NETWORK_KEY), 'ID', 'LABEL')
|
33
|
+
expect(topic.truncated_id).to eq('ID')
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'livefyre'
|
3
|
+
require 'livefyre/factory/cursor_factory'
|
4
|
+
|
5
|
+
include Livefyre
|
6
|
+
|
7
|
+
describe Livefyre::CursorFactory do
|
8
|
+
before(:each) do
|
9
|
+
@network = Livefyre.get_network(NETWORK_NAME, NETWORK_KEY)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should create a cursor with a personal stream resource' do
|
13
|
+
topic = Topic.create(@network, 'ID', 'LABEL')
|
14
|
+
cursor = CursorFactory.get_personal_stream_cursor(@network, USER_ID)
|
15
|
+
expect(cursor.data.resource).to eq("#{@network.get_urn_for_user(USER_ID)}:personalStream")
|
16
|
+
|
17
|
+
cursor = CursorFactory.get_personal_stream_cursor(@network, USER_ID, 10, Time.new)
|
18
|
+
expect(cursor.data.limit).to eq(10)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should create a cursor with a topic stream resource' do
|
22
|
+
topic = Topic.create(@network, 'ID', 'LABEL')
|
23
|
+
cursor = CursorFactory.get_topic_stream_cursor(@network, topic)
|
24
|
+
expect(cursor.data.resource).to eq("#{topic.id}:topicStream")
|
25
|
+
|
26
|
+
cursor = CursorFactory.get_topic_stream_cursor(@network, topic, 10, Time.new)
|
27
|
+
expect(cursor.data.limit).to eq(10)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'livefyre'
|
5
|
+
require 'jwt'
|
6
|
+
|
7
|
+
include Livefyre
|
8
|
+
|
9
|
+
describe Livefyre::LivefyreUtil do
|
10
|
+
it 'should check for valid and invalid urls' do
|
11
|
+
expect(LivefyreUtil::uri?('test.com')).to eq(false)
|
12
|
+
|
13
|
+
expect(LivefyreUtil::uri?('http://localhost:8000')).to eq(true)
|
14
|
+
expect(LivefyreUtil::uri?('http://清华大学.cn')).to eq(true)
|
15
|
+
expect(LivefyreUtil::uri?('http://www.mysite.com/myresumé.html')).to eq(true)
|
16
|
+
expect(LivefyreUtil::uri?('https://test.com/')).to eq(true)
|
17
|
+
expect(LivefyreUtil::uri?('ftp://test.com/')).to eq(true)
|
18
|
+
expect(LivefyreUtil::uri?("https://test.com/path/test.-_~!$&'()*+,;=:@/dash")).to eq(true)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should get network from all core objects' do
|
22
|
+
network = Livefyre.get_network(NETWORK_NAME, NETWORK_KEY)
|
23
|
+
site = network.get_site(SITE_ID, SITE_KEY)
|
24
|
+
collection = site.build_comments_collection(TITLE, ARTICLE_ID, URL)
|
25
|
+
|
26
|
+
expect(LivefyreUtil::get_network_from_core(network)).to eq(network)
|
27
|
+
expect(LivefyreUtil::get_network_from_core(site)).to eq(network)
|
28
|
+
expect(LivefyreUtil::get_network_from_core(collection)).to eq(network)
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
5
|
+
SimpleCov.start do
|
6
|
+
add_filter 'spec/'
|
7
|
+
add_filter 'lib/livefyre/exceptions'
|
8
|
+
end
|
9
|
+
|
10
|
+
Coveralls.wear!
|
11
|
+
|
12
|
+
begin
|
13
|
+
config = File.open('test.yml') { |yf| YAML::load(yf) }
|
14
|
+
env = config['production']
|
15
|
+
|
16
|
+
NETWORK_NAME = env['NETWORK_NAME']
|
17
|
+
NETWORK_KEY = env['NETWORK_KEY']
|
18
|
+
SITE_ID = env['SITE_ID']
|
19
|
+
SITE_KEY = env['SITE_KEY']
|
20
|
+
COLLECTION_ID = env['COLLECTION_ID']
|
21
|
+
USER_ID = env['USER_ID']
|
22
|
+
ARTICLE_ID = env['ARTICLE_ID']
|
23
|
+
rescue
|
24
|
+
NETWORK_NAME = ENV['NETWORK_NAME'] || '<NETWORK-NAME>'
|
25
|
+
NETWORK_KEY = ENV['NETWORK_KEY'] || '<NETWORK-KEY>'
|
26
|
+
SITE_ID = ENV['SITE_ID'] || '<SITE-ID>'
|
27
|
+
SITE_KEY = ENV['SITE_KEY'] || '<SITE-KEY>'
|
28
|
+
COLLECTION_ID = ENV['COLLECTION_ID'] || '<COLLECTION-ID>'
|
29
|
+
USER_ID = ENV['USER_ID'] || '<USER-ID>'
|
30
|
+
ARTICLE_ID = ENV['ARTICLE_ID'] || '<ARTICLE-ID>'
|
31
|
+
end
|
32
|
+
|
33
|
+
TITLE = 'RubyTest'
|
34
|
+
URL = 'http://answers.livefyre.com/RUBY'
|
metadata
CHANGED
@@ -1,123 +1,157 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: livefyre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Livefyre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rest-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
|
33
|
+
version: '1.7'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.7.2
|
37
|
+
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- -
|
41
|
+
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
43
|
+
version: '1.7'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.7.2
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
48
|
+
name: jwt
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - ~>
|
51
|
+
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1
|
48
|
-
- -
|
53
|
+
version: '0.1'
|
54
|
+
- - ">="
|
49
55
|
- !ruby/object:Gem::Version
|
50
|
-
version: 1.
|
51
|
-
type: :
|
56
|
+
version: 0.1.13
|
57
|
+
type: :runtime
|
52
58
|
prerelease: false
|
53
59
|
version_requirements: !ruby/object:Gem::Requirement
|
54
60
|
requirements:
|
55
|
-
- - ~>
|
61
|
+
- - "~>"
|
56
62
|
- !ruby/object:Gem::Version
|
57
|
-
version: '1
|
58
|
-
- -
|
63
|
+
version: '0.1'
|
64
|
+
- - ">="
|
59
65
|
- !ruby/object:Gem::Version
|
60
|
-
version: 1.
|
66
|
+
version: 0.1.13
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
68
|
+
name: addressable
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
64
70
|
requirements:
|
65
|
-
- - ~>
|
71
|
+
- - "~>"
|
66
72
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
68
|
-
- -
|
73
|
+
version: '2.3'
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.3.6
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2.3'
|
84
|
+
- - ">="
|
69
85
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
86
|
+
version: 2.3.6
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: bundler
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.7'
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.7.4
|
71
97
|
type: :development
|
72
98
|
prerelease: false
|
73
99
|
version_requirements: !ruby/object:Gem::Requirement
|
74
100
|
requirements:
|
75
|
-
- - ~>
|
101
|
+
- - "~>"
|
76
102
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
78
|
-
- -
|
103
|
+
version: '1.7'
|
104
|
+
- - ">="
|
79
105
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
106
|
+
version: 1.7.4
|
81
107
|
- !ruby/object:Gem::Dependency
|
82
108
|
name: rspec
|
83
109
|
requirement: !ruby/object:Gem::Requirement
|
84
110
|
requirements:
|
85
|
-
- - ~>
|
111
|
+
- - "~>"
|
86
112
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
88
|
-
- -
|
113
|
+
version: '3.1'
|
114
|
+
- - ">="
|
89
115
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
116
|
+
version: '3.1'
|
91
117
|
type: :development
|
92
118
|
prerelease: false
|
93
119
|
version_requirements: !ruby/object:Gem::Requirement
|
94
120
|
requirements:
|
95
|
-
- - ~>
|
121
|
+
- - "~>"
|
96
122
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
98
|
-
- -
|
123
|
+
version: '3.1'
|
124
|
+
- - ">="
|
99
125
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
126
|
+
version: '3.1'
|
101
127
|
- !ruby/object:Gem::Dependency
|
102
|
-
name:
|
128
|
+
name: coveralls
|
103
129
|
requirement: !ruby/object:Gem::Requirement
|
104
130
|
requirements:
|
105
|
-
- - ~>
|
131
|
+
- - "~>"
|
106
132
|
- !ruby/object:Gem::Version
|
107
|
-
version:
|
108
|
-
- - ! '>='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 2.3.6
|
133
|
+
version: 0.7.1
|
111
134
|
type: :development
|
112
135
|
prerelease: false
|
113
136
|
version_requirements: !ruby/object:Gem::Requirement
|
114
137
|
requirements:
|
115
|
-
- - ~>
|
138
|
+
- - "~>"
|
116
139
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
118
|
-
|
140
|
+
version: 0.7.1
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: simplecov
|
143
|
+
requirement: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - "~>"
|
119
146
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
147
|
+
version: 0.9.1
|
148
|
+
type: :development
|
149
|
+
prerelease: false
|
150
|
+
version_requirements: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - "~>"
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: 0.9.1
|
121
155
|
description: Livefyre Ruby utility classes
|
122
156
|
email:
|
123
157
|
- tools@livefyre.com
|
@@ -125,54 +159,75 @@ executables: []
|
|
125
159
|
extensions: []
|
126
160
|
extra_rdoc_files: []
|
127
161
|
files:
|
128
|
-
- .gitignore
|
129
|
-
- .idea/.name
|
130
|
-
- .idea/.rakeTasks
|
131
|
-
- .idea/encodings.xml
|
132
|
-
- .idea/
|
133
|
-
- .idea/
|
134
|
-
- .idea/
|
135
|
-
- .
|
136
|
-
- .idea/vcs.xml
|
137
|
-
- .project
|
162
|
+
- ".gitignore"
|
163
|
+
- ".idea/.name"
|
164
|
+
- ".idea/.rakeTasks"
|
165
|
+
- ".idea/encodings.xml"
|
166
|
+
- ".idea/scopes/scope_settings.xml"
|
167
|
+
- ".idea/vagrant.xml"
|
168
|
+
- ".idea/vcs.xml"
|
169
|
+
- ".project"
|
138
170
|
- CHANGELOG
|
139
171
|
- Gemfile
|
140
172
|
- LICENSE.txt
|
141
173
|
- README.md
|
142
174
|
- Rakefile
|
175
|
+
- circle.yml
|
143
176
|
- lib/livefyre.rb
|
177
|
+
- lib/livefyre/api/domain.rb
|
144
178
|
- lib/livefyre/api/personalized_stream.rb
|
179
|
+
- lib/livefyre/core/collection.rb
|
145
180
|
- lib/livefyre/core/network.rb
|
146
181
|
- lib/livefyre/core/site.rb
|
147
|
-
- lib/livefyre/
|
148
|
-
- lib/livefyre/
|
149
|
-
- lib/livefyre/
|
182
|
+
- lib/livefyre/cursor/timeline_cursor.rb
|
183
|
+
- lib/livefyre/dto/subscription.rb
|
184
|
+
- lib/livefyre/dto/topic.rb
|
185
|
+
- lib/livefyre/exceptions/api_exception.rb
|
186
|
+
- lib/livefyre/exceptions/livefyre_exception.rb
|
150
187
|
- lib/livefyre/factory/cursor_factory.rb
|
188
|
+
- lib/livefyre/model/collection_data.rb
|
189
|
+
- lib/livefyre/model/cursor_data.rb
|
190
|
+
- lib/livefyre/model/network_data.rb
|
191
|
+
- lib/livefyre/model/site_data.rb
|
192
|
+
- lib/livefyre/type/collection_type.rb
|
193
|
+
- lib/livefyre/type/subscription_type.rb
|
194
|
+
- lib/livefyre/utils/livefyre_util.rb
|
195
|
+
- lib/livefyre/validator/collection_validator.rb
|
196
|
+
- lib/livefyre/validator/cursor_validator.rb
|
197
|
+
- lib/livefyre/validator/network_validator.rb
|
198
|
+
- lib/livefyre/validator/site_validator.rb
|
151
199
|
- lib/livefyre/version.rb
|
152
200
|
- livefyre.gemspec
|
201
|
+
- spec/livefyre/api/domain_spec.rb
|
153
202
|
- spec/livefyre/api/personalized_stream_spec.rb
|
203
|
+
- spec/livefyre/core/collection_spec.rb
|
154
204
|
- spec/livefyre/core/network_spec.rb
|
155
205
|
- spec/livefyre/core/site_spec.rb
|
156
|
-
- spec/livefyre/
|
206
|
+
- spec/livefyre/cursor/timeline_cursor_spec.rb
|
207
|
+
- spec/livefyre/dto/subscription_spec.rb
|
208
|
+
- spec/livefyre/dto/topic_spec.rb
|
209
|
+
- spec/livefyre/factory/cursor_factory_spec.rb
|
210
|
+
- spec/livefyre/utils/utils_spec.rb
|
211
|
+
- spec/spec_helper.rb
|
157
212
|
homepage: http://github.com/livefyre/livefyre-ruby-utils
|
158
213
|
licenses:
|
159
214
|
- MIT
|
160
215
|
metadata: {}
|
161
|
-
post_install_message:
|
162
|
-
|
163
|
-
|
164
|
-
|
216
|
+
post_install_message: |2
|
217
|
+
! Note: this is a completely new version of the livefyre gem from Livefyre.
|
218
|
+
! Users that were using the previous livefyre gem (v.0.1.2) should now refer to livefyre-mashable.
|
219
|
+
! These two gems cannot be used in conjunction with one another as they share the same namespace.
|
165
220
|
rdoc_options: []
|
166
221
|
require_paths:
|
167
222
|
- lib
|
168
223
|
required_ruby_version: !ruby/object:Gem::Requirement
|
169
224
|
requirements:
|
170
|
-
- -
|
225
|
+
- - ">="
|
171
226
|
- !ruby/object:Gem::Version
|
172
227
|
version: '0'
|
173
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
229
|
requirements:
|
175
|
-
- -
|
230
|
+
- - ">="
|
176
231
|
- !ruby/object:Gem::Version
|
177
232
|
version: '0'
|
178
233
|
requirements: []
|
@@ -182,8 +237,15 @@ signing_key:
|
|
182
237
|
specification_version: 4
|
183
238
|
summary: Livefyre Ruby utility classes
|
184
239
|
test_files:
|
240
|
+
- spec/livefyre/api/domain_spec.rb
|
185
241
|
- spec/livefyre/api/personalized_stream_spec.rb
|
242
|
+
- spec/livefyre/core/collection_spec.rb
|
186
243
|
- spec/livefyre/core/network_spec.rb
|
187
244
|
- spec/livefyre/core/site_spec.rb
|
188
|
-
- spec/livefyre/
|
245
|
+
- spec/livefyre/cursor/timeline_cursor_spec.rb
|
246
|
+
- spec/livefyre/dto/subscription_spec.rb
|
247
|
+
- spec/livefyre/dto/topic_spec.rb
|
248
|
+
- spec/livefyre/factory/cursor_factory_spec.rb
|
249
|
+
- spec/livefyre/utils/utils_spec.rb
|
250
|
+
- spec/spec_helper.rb
|
189
251
|
has_rdoc:
|