croudia 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/croudia/api/search.rb +50 -0
- data/lib/croudia/version.rb +1 -1
- data/spec/croudia/api/search_spec.rb +47 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjE5M2E5YTZmNGU1ZjE4ZTliMWMyNmMwZjRkZjU4ZjExMDM1OTA1YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWMyNDM5YzgyM2Q0NjNjNzM0MWEyMmExNmZjMTFmYmU0YzgwODc2ZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDVmZDBhMzIxOGMxMGNmODQzZDg3MjhmNzYyZWMwNTE3MmEyYjFmYjE5M2Nm
|
10
|
+
Y2VhYWJiYjA3ZDhhM2FmYjA0ZDk4M2IyYTEzOWRmMzZmYmE5NmNmYmI2NTNk
|
11
|
+
ZWNkNTE4NWU4NTBiZWJjOTQ3ODhjMjdmNjFhY2I1YzkwNmFiZDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzRhZjVkNjdmNGRkNGIzMGFlZTc4NjU3YWNmMjNjNGI1NzQ3ODM2ZTVjNDZi
|
14
|
+
NTVkNjUyODc1NjJjM2QxZjcxOWNlYzEwZGRhYTliNDJlMWIzNzMzOTIxNGY3
|
15
|
+
ZjMyNTVjN2NkMzMxNTFiZjk3NjhiNzg4OTg2ZTFjZTYxNDk3OGI=
|
data/lib/croudia/api/search.rb
CHANGED
@@ -54,6 +54,56 @@ module Croudia
|
|
54
54
|
objects(Croudia::User, resp)
|
55
55
|
end
|
56
56
|
alias search_users search_user
|
57
|
+
|
58
|
+
# Search for users with profile
|
59
|
+
#
|
60
|
+
# @see https://developer.croudia.com/docs/83_profile_search
|
61
|
+
# @overload search_user_by_profile(q, params={})
|
62
|
+
# @param [String] q Search query
|
63
|
+
# @param [Hash] params Additional query parameters
|
64
|
+
# @option params [String, Integer] :count Number of users in the response
|
65
|
+
# @option params [String] :include_entities Set false to exclude entities
|
66
|
+
# @option params [String] :trim_user Set true to return compact user objects
|
67
|
+
# @overload search_user_by_profile(params={})
|
68
|
+
# @param [Hash] params Query parameters
|
69
|
+
# @option params [String] :q Search query
|
70
|
+
# @option params [String, Integer] :count Number of users in the response
|
71
|
+
# @option params [String, Integer] :page Page to fetch, up to 1000
|
72
|
+
# @option params [String] :trim_user Set true to return compact user objects
|
73
|
+
# @return [Array<Croudia::User>] Users found
|
74
|
+
def search_user_by_profile(q, params={})
|
75
|
+
merge_query!(params, q)
|
76
|
+
resp = get('/profile/search.json', params)
|
77
|
+
objects(Croudia::User, resp)
|
78
|
+
end
|
79
|
+
alias search_users_by_profile search_user_by_profile
|
80
|
+
|
81
|
+
# Search for statuses the authenticated user has favorited
|
82
|
+
#
|
83
|
+
# @see https://developer.croudia.com/docs/84_search_favorites
|
84
|
+
# @overload search_favorites(q, params={})
|
85
|
+
# @param [String] q Search query
|
86
|
+
# @param [Hash] params Additional query parameters
|
87
|
+
# @option params [String, Integer] :count Number of statuses in the response
|
88
|
+
# @option params [String] :include_entities Set false to exclude entities
|
89
|
+
# @option params [String, Integer] :max_id Paging parameter
|
90
|
+
# @option params [String, Integer] :since_id Paging parameter
|
91
|
+
# @option params [String] :trim_user Set true to return compact user objects
|
92
|
+
# @overload search_favorites(params={})
|
93
|
+
# @param [Hash] params Query parameters
|
94
|
+
# @option params [String] :q Search query
|
95
|
+
# @option params [String, Integer] :count Number of statuses in the response
|
96
|
+
# @option params [String] :include_entities Set false to exclude entities
|
97
|
+
# @option params [String, Integer] :max_id Paging parameter
|
98
|
+
# @option params [String, Integer] :since_id Paging parameter
|
99
|
+
# @option params [String] :trim_user Set true to return compact user objects
|
100
|
+
# @return [Croudia::SearchResults]
|
101
|
+
def search_favorites(q, params={})
|
102
|
+
merge_query!(params, q)
|
103
|
+
resp = get('/search/favorites.json', params)
|
104
|
+
Croudia::SearchResults.new(resp)
|
105
|
+
end
|
106
|
+
|
57
107
|
end
|
58
108
|
end
|
59
109
|
end
|
data/lib/croudia/version.rb
CHANGED
@@ -51,4 +51,51 @@ describe Croudia::API::Search do
|
|
51
51
|
subject.each { |user| expect(user).to be_a Croudia::User }
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
describe '#search_user_by_profile' do
|
56
|
+
before do
|
57
|
+
stub_get('/profile/search.json').with(query: {
|
58
|
+
q: 'hoge',
|
59
|
+
}).to_return(
|
60
|
+
body: fixture(:users),
|
61
|
+
headers: { content_type: 'application/json; charset=utf-8' }
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'requests the correct resource' do
|
66
|
+
@client.search_user_by_profile('hoge')
|
67
|
+
expect(a_get('/profile/search.json').with(query: {
|
68
|
+
q: 'hoge',
|
69
|
+
})).to have_been_made
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'returns an array of Croudia::User' do
|
73
|
+
subject = @client.search_user_by_profile('hoge')
|
74
|
+
expect(subject).to be_a Array
|
75
|
+
subject.each { |user| expect(user).to be_a Croudia::User }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#search_favorites' do
|
80
|
+
before do
|
81
|
+
stub_get('/search/favorites.json').with(query: {
|
82
|
+
q: 'hoge',
|
83
|
+
}).to_return(
|
84
|
+
body: fixture(:search_results),
|
85
|
+
headers: { content_type: 'application/json; charset=utf-8' }
|
86
|
+
)
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'requests the correct resource' do
|
90
|
+
@client.search_favorites('hoge')
|
91
|
+
expect(a_get('/search/favorites.json').with(query: {
|
92
|
+
q: 'hoge',
|
93
|
+
})).to have_been_made
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'returns Croudia::SearchResults' do
|
97
|
+
subject = @client.search_favorites('hoge')
|
98
|
+
expect(subject).to be_a Croudia::SearchResults
|
99
|
+
end
|
100
|
+
end
|
54
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: croudia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wktk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
202
|
version: '0'
|
203
203
|
requirements: []
|
204
204
|
rubyforge_project:
|
205
|
-
rubygems_version: 2.1
|
205
|
+
rubygems_version: 2.2.1
|
206
206
|
signing_key:
|
207
207
|
specification_version: 4
|
208
208
|
summary: Croudia API
|