googleplus-reader 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7be44f0159805b65d7933c87b18f492cf3def380
4
- data.tar.gz: 858d27889d93276aff2dbb0261e5fb61ba8fee17
3
+ metadata.gz: 9a7b7cd4b05d69de7ff5ad7ff346a55b2db9c01f
4
+ data.tar.gz: 431120ec1468347c8febfc96356249544408923b
5
5
  SHA512:
6
- metadata.gz: 7de3bce12c30b1694edfa0687cbfde4e85ac227a2ddb0374ecff6a2dcfc1936053b8f07e264e8ecc1168946b1edb6989f725d8a33058011856d074a3b3ae6449
7
- data.tar.gz: 206f17d40101ee0f35bf813ce05fe12ef5108095d42721a69c3a9ebf3eeb2fc973937d6ce086f412413d8ef510e9302f09a423c3ba272afcf900269a706e757a
6
+ metadata.gz: 9fa129195dfa021e8a2e53c086b62295825378ba303be9f7f90409940d389e12ba3db9cffaa63242b3220fea0654d12c27296ec3602d1536e86e1c2e7ffa5c58
7
+ data.tar.gz: 6cb5bf38b8cb1b557aa5c5319988aa2a7843f45bbdcdc48852ee8ea03f0d9302cec9ffd38aaebd3051ea50964726d847f51e93ec9c5f5157d0afdb0c61c9dca1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## GooglePlus Reader 0.0.6 (December 5, 2014)
2
+
3
+ * Added `find` for fetching only one activity.
4
+
1
5
  ## GooglePlus Reader 0.0.5 (August 4, 2014)
2
6
 
3
7
  * Added support for [RequireJS](http://requirejs.org/).
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # GooglePlus Reader [![Gem Version](https://badge.fury.io/rb/googleplus-reader.svg)](http://badge.fury.io/rb/googleplus-reader)
2
2
 
3
- A library for reading public posts of a [Google+](https://plus.google.com)
4
- user. A life demo can be found [here](http://photography.ivanukhov.com) and
5
- its source code [here](https://github.com/IvanUkhov/photography). Best enjoyed
6
- responsibly.
3
+ The library provides an interface for reading public activities of a
4
+ [Google+](https://plus.google.com) user. A life demo can be found
5
+ [here](http://photography.ivanukhov.com) and its source code
6
+ [here](https://github.com/IvanUkhov/photography). Best enjoyed responsibly.
7
7
 
8
8
  ## Installation
9
9
 
@@ -59,10 +59,9 @@ reader.next(5).done (posts) ->
59
59
  ```
60
60
 
61
61
  Here `user_id` is the identifier of a Google+ user, and `api_key` is your
62
- [Google+ API key](https://developers.google.com/+/api/oauth).
63
- `post` is exactly what Google has to say about each post without any
64
- additional preprocessing. You might want to inspect it and fetch what is
65
- needed for your application.
62
+ [Google+ API key](https://developers.google.com/+/api/oauth). `post` is exactly
63
+ what Google has to say about each post without any additional preprocessing.
64
+ You might want to inspect it and fetch what is needed for your application.
66
65
 
67
66
  A more interesting example with photos that a user publishes:
68
67
 
@@ -77,10 +76,10 @@ reader.next(5).done (photos) ->
77
76
  console.log(photo.attributes) for photo in photos
78
77
  ```
79
78
 
80
- `photo` is an instance of `GooglePlus.Photo`. Right now, `attributes`
81
- contain only `url`, `date`, and `width` (if available), but other parameters
82
- can be easily added via a pull request >:)~ The only method that `photo`
83
- has is `load`, which can be used as follows:
79
+ `photo` is an instance of `GooglePlus.Photo`. Right now, `attributes` contains
80
+ only `url`, `date`, and `width` (if available), but other parameters can be
81
+ easily added via a pull request >:)~ The only method that `photo` has is
82
+ `load`, which can be used as follows:
84
83
 
85
84
  ```coffee
86
85
  photo.load().done (element) ->
@@ -99,10 +98,6 @@ loaded.
99
98
 
100
99
  ## Contributing
101
100
 
102
- 1. [Fork](https://help.github.com/articles/fork-a-repo) the project.
103
- 2. Create a branch for your feature (`git checkout -b awesome-feature`).
104
- 3. Implement your feature (`vim`).
105
- 4. Commit your changes (`git commit -am 'Implemented an awesome feature'`).
106
- 5. Push to the branch (`git push origin awesome-feature`).
107
- 6. [Create](https://help.github.com/articles/creating-a-pull-request)
108
- a new Pull Request.
101
+ 1. Fork the project.
102
+ 2. Implement your idea.
103
+ 3. Create a pull request.
@@ -4,16 +4,17 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'googleplus/reader/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = 'googleplus-reader'
8
- spec.version = GooglePlus::Reader::VERSION
9
- spec.authors = [ 'Ivan Ukhov' ]
10
- spec.email = [ 'ivan.ukhov@gmail.com' ]
11
- spec.summary = 'A jQuery-based library for reading public posts of a Google+ user'
12
- spec.homepage = 'https://github.com/IvanUkhov/googleplus-reader'
13
- spec.license = 'MIT'
7
+ spec.name = 'googleplus-reader'
8
+ spec.version = GooglePlus::Reader::VERSION
9
+ spec.authors = ['Ivan Ukhov']
10
+ spec.email = ['ivan.ukhov@gmail.com']
11
+ spec.summary = 'A jQuery-based library for reading Google+ activities'
12
+ spec.description = 'The library provides an interface for reading public activities of a Google+ user.'
13
+ spec.homepage = 'https://github.com/IvanUkhov/googleplus-reader'
14
+ spec.license = 'MIT'
14
15
 
15
16
  spec.files = `git ls-files -z`.split("\x0")
16
17
 
17
18
  spec.add_development_dependency 'bundler', '~> 1.6'
18
- spec.add_development_dependency 'rake'
19
+ spec.add_development_dependency 'rake', '~> 0'
19
20
  end
@@ -5,7 +5,9 @@ unless typeof define is 'function' and define.amd
5
5
 
6
6
  define 'googleplus.photoreader', ['googleplus.reader', 'googleplus.photo'], (Reader, Photo) ->
7
7
  class extends Reader
8
- append: (items) ->
8
+ process: (items) ->
9
+ collection = []
10
+
9
11
  for item in items
10
12
  continue unless item.verb?
11
13
  continue unless item.verb is 'post'
@@ -25,12 +27,12 @@ define 'googleplus.photoreader', ['googleplus.reader', 'googleplus.photo'], (Rea
25
27
  continue unless attachment.image?
26
28
 
27
29
  if attachment.fullImage?
28
- @collection.push new Photo
30
+ collection.push new Photo
29
31
  url: attachment.image.url,
30
32
  width: attachment.fullImage.width,
31
33
  date: date
32
34
  else
33
- @collection.push new Photo
35
+ collection.push new Photo
34
36
  url: attachment.image.url,
35
37
  width: null,
36
38
  date: date
@@ -41,9 +43,9 @@ define 'googleplus.photoreader', ['googleplus.reader', 'googleplus.photo'], (Rea
41
43
  for thumbnail in attachment.thumbnails
42
44
  continue unless thumbnail.image?
43
45
 
44
- @collection.push new Photo
46
+ collection.push new Photo
45
47
  url: thumbnail.image.url,
46
48
  width: null,
47
49
  date: date
48
50
 
49
- return
51
+ collection
@@ -8,9 +8,27 @@ define 'googleplus.reader', ['jquery'], ($) ->
8
8
  constructor: (options) ->
9
9
  @id = options.id
10
10
  @key = options.key
11
+ @reset()
12
+
13
+ reset: ->
11
14
  @token = null
12
15
  @collection = []
13
16
  @position = 0
17
+ return
18
+
19
+ find: (id) ->
20
+ deferred = $.Deferred()
21
+
22
+ @get(id)
23
+ .done (result) =>
24
+ deferred.resolve(@process([result]))
25
+ return
26
+
27
+ .fail (details...) =>
28
+ deferred.reject(details...)
29
+ return
30
+
31
+ deferred.promise()
14
32
 
15
33
  next: (count) ->
16
34
  deferred = $.Deferred()
@@ -23,8 +41,9 @@ define 'googleplus.reader', ['jquery'], ($) ->
23
41
  deferred.resolve(elements)
24
42
 
25
43
  else
26
- @load()
27
- .done =>
44
+ @list()
45
+ .done (result) =>
46
+ @collection.push(item) for item in @process(result.items)
28
47
  nextPosition = Math.min(nextPosition, @collection.length)
29
48
  elements = @collection.slice(@position, nextPosition)
30
49
  @position = nextPosition
@@ -37,15 +56,16 @@ define 'googleplus.reader', ['jquery'], ($) ->
37
56
 
38
57
  deferred.promise()
39
58
 
40
- load: ->
59
+ get: (id) ->
60
+ url = "https://www.googleapis.com/plus/v1/activities/#{id}?key=#{@key}"
61
+ $.ajax(url: url, crossDomain: true, dataType: 'jsonp')
62
+
63
+ list: ->
41
64
  url = "https://www.googleapis.com/plus/v1/people/#{@id}/activities/public?key=#{@key}"
42
65
  url = "#{url}&pageToken=#{@token}" if @token
43
-
44
66
  $.ajax(url: url, crossDomain: true, dataType: 'jsonp').done (result) =>
45
- @append(result.items)
46
67
  @token = result.nextPageToken
47
68
  return
48
69
 
49
- append: (items) ->
50
- @collection.push(item) for item in items
51
- return
70
+ process: (items) ->
71
+ items
@@ -1,5 +1,5 @@
1
1
  module GooglePlus
2
2
  module Reader
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: googleplus-reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Ukhov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-04 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,17 +28,18 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description:
41
+ description: The library provides an interface for reading public activities of a
42
+ Google+ user.
42
43
  email:
43
44
  - ivan.ukhov@gmail.com
44
45
  executables: []
@@ -77,9 +78,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
78
  version: '0'
78
79
  requirements: []
79
80
  rubyforge_project:
80
- rubygems_version: 2.2.2
81
+ rubygems_version: 2.4.3
81
82
  signing_key:
82
83
  specification_version: 4
83
- summary: A jQuery-based library for reading public posts of a Google+ user
84
+ summary: A jQuery-based library for reading Google+ activities
84
85
  test_files: []
85
- has_rdoc: