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
data/.idea/misc.xml
DELETED
data/.idea/modules.xml
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="ProjectModuleManager">
|
4
|
-
<modules>
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/livefyre-ruby-utils.iml" filepath="$PROJECT_DIR$/.idea/livefyre-ruby-utils.iml" />
|
6
|
-
</modules>
|
7
|
-
</component>
|
8
|
-
</project>
|
9
|
-
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'livefyre/api/personalized_stream'
|
2
|
-
|
3
|
-
module Livefyre
|
4
|
-
class TimelineCursor
|
5
|
-
def initialize(core, resource, limit, date)
|
6
|
-
@core = core
|
7
|
-
@resource = resource
|
8
|
-
@limit = limit
|
9
|
-
@next = false
|
10
|
-
@previous = false
|
11
|
-
|
12
|
-
@cursor_time = date.utc.iso8601(3)
|
13
|
-
end
|
14
|
-
|
15
|
-
def next(limit=@limit)
|
16
|
-
data = PersonalizedStream::get_timeline_stream(@core, @resource, limit, nil, @cursor_time)
|
17
|
-
cursor = data['meta']['cursor']
|
18
|
-
|
19
|
-
@next = cursor['hasNext']
|
20
|
-
@previous = cursor['next'] != nil
|
21
|
-
@cursor_time = cursor['next']
|
22
|
-
|
23
|
-
data
|
24
|
-
end
|
25
|
-
|
26
|
-
def previous(limit=@limit)
|
27
|
-
data = PersonalizedStream::get_timeline_stream(@core, @resource, limit, @cursor_time, nil)
|
28
|
-
cursor = data['meta']['cursor']
|
29
|
-
|
30
|
-
@previous = cursor['hasPrev']
|
31
|
-
@next = cursor['prev'] != nil
|
32
|
-
@cursor_time = cursor['prev']
|
33
|
-
|
34
|
-
data
|
35
|
-
end
|
36
|
-
|
37
|
-
def set_cursor_time(time)
|
38
|
-
@cursor_time = time.utc.iso8601(3)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|