croudia 1.0.5 → 1.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: 4c74b6ada9b04df96b347e458384ad64a14744cb
4
- data.tar.gz: 257ca2a1b2fe3e46a51b163d6f65fad0d2692e45
3
+ metadata.gz: 8602e9464991c5cf32f2bb90c876ff49fc75bd14
4
+ data.tar.gz: 9885d3ac96bc597383d66cf0ea44e089b62754e9
5
5
  SHA512:
6
- metadata.gz: b3612bdb2751c1f0ded07f687ecd695d36ca03275b9927d6f5aa3f614194b1a98b8d6e6f4eed13ec1ce7f9f25e5cf6514129061e8fa19ec6e9bf03b771950de6
7
- data.tar.gz: 3c9f5ed43a01ad3e27641fc8e13afdca87194595598cc1d50b6d45609d961ae6838f72e7b9bc12e873255878d6482614babc25b036134de512ce80b9238a3b97
6
+ metadata.gz: 88d2d921cf8b1da8e1ab1337b56b67309775153c314098cc0982e2fcc2d2f055c17d25cf745eab6de6193e6dbd3b2d171ed49c9338cff1fee9201eb7f99ebc65
7
+ data.tar.gz: b82159c956cd035b9e0c0a20ba2f7f95efc17b560ec539276c0129de3c0ed2df0b55f8b603e6386d11467ade6a9f9caaa8cca12f82341d7b3295034cab2d5ed8
@@ -3,6 +3,23 @@ require 'croudia/status'
3
3
  module Croudia
4
4
  module API
5
5
  module Favorites
6
+ # List of favorited statuses
7
+ #
8
+ # @param user [String]
9
+ # @param params [Hash]
10
+ # @return [Array<Croudia::Status>]
11
+ def favorites(user={}, params={})
12
+ resp = case user
13
+ when Hash
14
+ params.merge!(user)
15
+ get('/favorites.json', params)
16
+ else
17
+ get("/favorites/#{user}.json", params)
18
+ end
19
+
20
+ objects(Croudia::Status, resp)
21
+ end
22
+
6
23
  # Favorite a status
7
24
  #
8
25
  # @param status_id [String, Integer, Croudia::Status]
@@ -1,3 +1,3 @@
1
1
  module Croudia
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.6'
3
3
  end
@@ -5,6 +5,42 @@ describe Croudia::API::Favorites do
5
5
  @client = Croudia::Client.new
6
6
  end
7
7
 
8
+ describe '#favorites' do
9
+ context 'when user is not specified' do
10
+ before do
11
+ stub_get('/favorites.json').to_return(
12
+ body: fixture(:timeline),
13
+ headers: { content_type: 'application/json; charset=utf-8' }
14
+ )
15
+ end
16
+
17
+ it 'requests the correct resource' do
18
+ @client.favorites
19
+ expect(a_get('/favorites.json')).to have_been_made
20
+ end
21
+
22
+ it 'returns Array of Croudia::Status' do
23
+ subject = @client.favorites
24
+ expect(subject).to be_an Array
25
+ subject.each { |s| expect(s).to be_a Croudia::Status }
26
+ end
27
+ end
28
+
29
+ context 'when user is specified' do
30
+ before do
31
+ stub_get('/favorites/wktk.json').to_return(
32
+ body: fixture(:timeline),
33
+ headers: { content_type: 'application/json; charset=utf-8' }
34
+ )
35
+ end
36
+
37
+ it 'requests the correct resource' do
38
+ @client.favorites('wktk')
39
+ expect(a_get('/favorites/wktk.json')).to have_been_made
40
+ end
41
+ end
42
+ end
43
+
8
44
  describe '#favorite' do
9
45
  before do
10
46
  stub_post('/favorites/create/1234.json').to_return(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: croudia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - wktk