livefyre 1.3.2 → 2.0.0

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.
Files changed (46) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +3 -6
  3. data/CHANGELOG +10 -0
  4. data/README.md +3 -66
  5. data/circle.yml +10 -0
  6. data/lib/livefyre.rb +1 -1
  7. data/lib/livefyre/api/domain.rb +15 -0
  8. data/lib/livefyre/api/personalized_stream.rb +79 -72
  9. data/lib/livefyre/core/collection.rb +93 -0
  10. data/lib/livefyre/core/network.rb +61 -56
  11. data/lib/livefyre/core/site.rb +34 -82
  12. data/lib/livefyre/cursor/timeline_cursor.rb +45 -0
  13. data/lib/livefyre/{entity → dto}/subscription.rb +12 -14
  14. data/lib/livefyre/{entity → dto}/topic.rb +16 -13
  15. data/lib/livefyre/exceptions/api_exception.rb +29 -0
  16. data/lib/livefyre/exceptions/livefyre_exception.rb +9 -0
  17. data/lib/livefyre/factory/cursor_factory.rb +4 -4
  18. data/lib/livefyre/model/collection_data.rb +30 -0
  19. data/lib/livefyre/model/cursor_data.rb +17 -0
  20. data/lib/livefyre/model/network_data.rb +10 -0
  21. data/lib/livefyre/model/site_data.rb +10 -0
  22. data/lib/livefyre/type/collection_type.rb +11 -0
  23. data/lib/livefyre/type/subscription_type.rb +5 -0
  24. data/lib/livefyre/utils/livefyre_util.rb +24 -0
  25. data/lib/livefyre/validator/collection_validator.rb +33 -0
  26. data/lib/livefyre/validator/cursor_validator.rb +15 -0
  27. data/lib/livefyre/validator/network_validator.rb +19 -0
  28. data/lib/livefyre/validator/site_validator.rb +14 -0
  29. data/lib/livefyre/version.rb +1 -1
  30. data/livefyre.gemspec +15 -12
  31. data/spec/livefyre/api/domain_spec.rb +40 -0
  32. data/spec/livefyre/api/personalized_stream_spec.rb +54 -37
  33. data/spec/livefyre/core/collection_spec.rb +90 -0
  34. data/spec/livefyre/core/network_spec.rb +32 -6
  35. data/spec/livefyre/core/site_spec.rb +24 -62
  36. data/spec/livefyre/cursor/timeline_cursor_spec.rb +25 -0
  37. data/spec/livefyre/dto/subscription_spec.rb +27 -0
  38. data/spec/livefyre/dto/topic_spec.rb +35 -0
  39. data/spec/livefyre/factory/cursor_factory_spec.rb +29 -0
  40. data/spec/livefyre/utils/utils_spec.rb +30 -0
  41. data/spec/spec_helper.rb +34 -0
  42. metadata +134 -72
  43. data/.idea/misc.xml +0 -5
  44. data/.idea/modules.xml +0 -9
  45. data/lib/livefyre/entity/timeline_cursor.rb +0 -41
  46. data/spec/livefyre/test_spec.rb +0 -7
data/.idea/misc.xml DELETED
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.9.3-p484 [global]" project-jdk-type="RUBY_SDK" />
4
- </project>
5
-
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
@@ -1,7 +0,0 @@
1
- NETWORK_NAME = '<NETWORK-NAME>'
2
- NETWORK_KEY = '<NETWORK-KEY>'
3
- SITE_ID = '<SITE-ID>'
4
- SITE_KEY = '<SITE-KEY>'
5
- COLLECTION_ID = '<COLLECTION-ID>'
6
- USER = '<USER-ID>'
7
- ARTICLE_ID = '<ARTICLE-ID>'