livefyre 1.1.0 → 1.1.1
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 +8 -8
- data/README.md +7 -0
- data/lib/livefyre/core.rb +14 -6
- data/lib/livefyre/version.rb +1 -1
- data/spec/livefyre/core_spec.rb +14 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjkyNWUzNzE3OGFhNTJiNTc1ZjBmN2I4ZDY5OGVlYjkyOGVjMzE1Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjBjMTkyMTIxMmRlMjQ2YWI4NGVmYmRhODZmZjQxNzk5M2Q1NDVhMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2VhZGI2MmMyOTZkOGZhN2UzMTY2YWYzNmE4NGRhYTJiMzZjYWE2YzdlZmE4
|
10
|
+
YWMwZjA5NGVjMTQ1NmVkNjNlZTMyN2ViMjBiYWU2MTNhNWNhNWI1Y2E5MDQ2
|
11
|
+
MDIyZTExNTY0ZTQ2NTYwMWNkM2JiOTVjN2RhMDQ3MjZkZWU1MzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDBhMWRjMDA3MWMxODA0MDY5MjIzYmU5ZTAzZjVmMGQyNDlhNGJlNmFjOTBh
|
14
|
+
MGUzMDhkNGExZDkzM2ZiMDFjMGM4MTlkNDg4NjRkOTEwYjhiNjUzODQ4NGY5
|
15
|
+
Yjg5NWI5MWRhZjhiZDg3NDg3ZDgzY2M0YTkxMGIyYmRkZDE3NjU=
|
data/README.md
CHANGED
@@ -59,6 +59,13 @@ Building a collection meta token:
|
|
59
59
|
site.build_collection_meta_token('title', 'article_id', 'url', 'tags', 'stream')
|
60
60
|
```
|
61
61
|
|
62
|
+
Building a checksum:
|
63
|
+
*The 'tags' argument is optional.*
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
site.build_checksum('title', 'url', 'tags')
|
67
|
+
```
|
68
|
+
|
62
69
|
To retrieve content collection data:
|
63
70
|
|
64
71
|
```ruby
|
data/lib/livefyre/core.rb
CHANGED
@@ -73,18 +73,26 @@ module Livefyre
|
|
73
73
|
raise ArgumentError, 'provided url is not a valid url' if !uri?(url)
|
74
74
|
raise ArgumentError, 'title length should be under 255 char' if title.length > 255
|
75
75
|
|
76
|
-
collection_meta = {
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
76
|
+
collection_meta = {
|
77
|
+
url: url,
|
78
|
+
tags: tags,
|
79
|
+
title: title,
|
80
|
+
articleId: article_id
|
81
|
+
}
|
82
82
|
if stream
|
83
83
|
collection_meta[:type] = stream
|
84
84
|
end
|
85
85
|
|
86
86
|
JWT.encode(collection_meta, @site_key)
|
87
87
|
end
|
88
|
+
|
89
|
+
def build_checksum(title, url, tags='')
|
90
|
+
raise ArgumentError, 'provided url is not a valid url' if !uri?(url)
|
91
|
+
raise ArgumentError, 'title length should be under 255 char' if title.length > 255
|
92
|
+
|
93
|
+
collection_meta = { url: url, tags: tags, title: title }
|
94
|
+
Digest::MD5.new.update(collection_meta.to_json).hexdigest
|
95
|
+
end
|
88
96
|
|
89
97
|
def get_collection_content(article_id)
|
90
98
|
response =
|
data/lib/livefyre/version.rb
CHANGED
data/spec/livefyre/core_spec.rb
CHANGED
@@ -23,15 +23,27 @@ describe Livefyre::Network::Site do
|
|
23
23
|
@site = Livefyre.get_network('networkName', 'networkKey').get_site('siteId', "siteKey")
|
24
24
|
end
|
25
25
|
|
26
|
-
it 'should raise ArgumentError if url is not a valid url' do
|
26
|
+
it 'should raise ArgumentError if url is not a valid url for cmt' do
|
27
27
|
expect{ @site.build_collection_meta_token('test', 'test', 'blah.com/', 'test') }.to raise_error(ArgumentError)
|
28
28
|
end
|
29
29
|
|
30
|
-
it 'should raise ArgumentError if title is more than 255 characters' do
|
30
|
+
it 'should raise ArgumentError if title is more than 255 characters for cmt' do
|
31
31
|
expect{ @site.build_collection_meta_token('1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456', 'test', 'http://test.com', 'test') }.to raise_error(ArgumentError)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should return a collection meta token' do
|
35
35
|
expect{ @site.build_collection_meta_token('title', 'article_id', 'https://www.url.com', 'tags') }.to be_true
|
36
36
|
end
|
37
|
+
|
38
|
+
it 'should raise ArgumentError if url is not a valid url for checksum' do
|
39
|
+
expect{ @site.build_checksum('test', 'blah.com/', 'test') }.to raise_error(ArgumentError)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should raise ArgumentError if title is more than 255 characters for checksum' do
|
43
|
+
expect{ @site.build_checksum('1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456', 'http://test.com', 'test') }.to raise_error(ArgumentError)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should return a valid checksum' do
|
47
|
+
expect(@site.build_checksum('title', 'https://www.url.com', 'tags')).to eq('6e2e4faf7b95f896260fe695eafb34ba')
|
48
|
+
end
|
37
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: livefyre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Livefyre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|