croudia 1.0.15 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ba8b2c711483759304f9c6e9d3142c595ba5f8fc
4
- data.tar.gz: 2b00fe7aa4eed970cedfc9175bd3d49c0bdc1baf
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWQ4YmRkODRiMGQxYTkyM2Q5ZDQ3MGUxMjY3ZmIxNWYwNmU3ZTkwMA==
5
+ data.tar.gz: !binary |-
6
+ MzVkY2I2N2NhZjhmMDhlNGUyODg3Y2FmMGNkNjYxMzc0ODRmYzg3Mw==
5
7
  SHA512:
6
- metadata.gz: 724038816211fd2537c9cc8cbfe00d4476d58f4444318964d7d821f7c5faa15d5e5716358ac52f4155ae932ce64be48b46c3506ab95d3f5b7469b0060316712a
7
- data.tar.gz: ea16c2207d4eae82ee7d1261f6047f7c7cad0dc2e01b647b2629877977347953b85cebacac57e352868f844505c17963efe927918858d2403fe7870a4bf3a76a
8
+ metadata.gz: !binary |-
9
+ MTU5MzU5ZWVjMjZiMjJiOTEzMzUwZTcyZmFhNjhkODcyM2VkNTc0ZjgxMWQw
10
+ OWY1YWY4MDM2YmMxOTFiMWI0NzhjMTc3MDVmMWYyNTg5OTBlOTYxYjJiYTY0
11
+ ZmU0ZWJmZTBlNzkyNGM5YzEwYmIzOTcyZGVjYzFmMTc5YmM2MmI=
12
+ data.tar.gz: !binary |-
13
+ MWY1MjI4OGJiZWNjOTRhZDk4MTAyNTEzMDg2YWIwYTVkYjQ1ZWY3YTYxODVl
14
+ MjM0M2IyNmNiOGU2OGUzMDA4YTdkMmU4ZGU2YThkM2VkOGRlNWE3ZGY4Yzdk
15
+ OGE1NzlkOTkwNjUyNjQ0Njg2ZjIxMDNjNDZmMmZlMDM4MTk1Y2U=
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .env
6
+ .rbenv-vars
6
7
  .yardoc
7
8
  Gemfile.lock
8
9
  InstalledFiles
data/README.md CHANGED
@@ -11,7 +11,7 @@ Croudia is a registered trademark of Croudia Inc. in Japan.
11
11
 
12
12
  Add this line to your application's Gemfile:
13
13
 
14
- gem 'croudia'
14
+ gem "croudia", "~> 1.0"
15
15
 
16
16
  And then execute:
17
17
 
@@ -66,6 +66,9 @@ home_timeline = croudia.home_timeline
66
66
  posted_status = croudia.update("Hello!")
67
67
  ```
68
68
 
69
+ The full documentation of `Croudia::Client` is available at:
70
+ http://rdoc.info/gems/croudia/Croudia/Client
71
+
69
72
  ## Contributing
70
73
 
71
74
  1. Fork it
@@ -5,7 +5,8 @@ module Croudia
5
5
  module Account
6
6
  # Retrieve the Authenticated User
7
7
  #
8
- # @params params [Hash] Additional params
8
+ # @see https://developer.croudia.com/docs/35_account_verify_credentials
9
+ # @param [Hash] params Additional query parameterss
9
10
  # @return [Croudia::User] Current user's object
10
11
  def verify_credentials(params={})
11
12
  resp = get('/account/verify_credentials.json', params)
@@ -15,9 +16,14 @@ module Croudia
15
16
 
16
17
  # Update profile image
17
18
  #
18
- # @param image [File] New profile image
19
- # @param params [Hash]
20
- # @return [Croudia::User] Authenticated user object with new image
19
+ # @see https://developer.croudia.com/docs/36_account_update_profile_image
20
+ # @overload update_profile_image(image, params={})
21
+ # @param [File] image New profile image
22
+ # @param [Hash] params Addtional query parameters
23
+ # @overload update_profile_image(params={})
24
+ # @param [Hash] params Query parameters
25
+ # @option params [File] :image New profile image
26
+ # @return [Croudia::User] Current user's object updated
21
27
  def update_profile_image(image, params={})
22
28
  merge_file!(params, image, :image)
23
29
  resp = post('/account/update_profile_image.json', params)
@@ -26,7 +32,12 @@ module Croudia
26
32
 
27
33
  # Update profile
28
34
  #
29
- # @param params [Hash]
35
+ # @see https://developer.croudia.com/docs/37_account_update_profile
36
+ # @param [Hash] params Additional query parameters
37
+ # @option params [String] :description Bio of the user
38
+ # @option params [String] :location Geo location
39
+ # @option params [String] :name Name of the user
40
+ # @option params [String] :url URL
30
41
  # @return [Croudia::User] Updated profile
31
42
  def update_profile(params)
32
43
  resp = post('/account/update_profile.json', params)
@@ -5,25 +5,24 @@ module Croudia
5
5
  module Favorites
6
6
  # List of favorited statuses
7
7
  #
8
- # @param user [String]
9
- # @param params [Hash]
8
+ # @see https://developer.croudia.com/docs/51_favorites
9
+ # @param [Hash] params Additional query parameters
10
+ # @option params [String, Integer] :count Number of statuses in the response
11
+ # @option params [String] :include_entities Set false to exclude entities
12
+ # @option params [String, Integer] :max_id Paging parameter
13
+ # @option params [String, Integer] :since_id Paging parameter
10
14
  # @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
-
15
+ def favorites(params={})
16
+ resp = get('/favorites.json', params)
20
17
  objects(Croudia::Status, resp)
21
18
  end
22
19
 
23
20
  # Favorite a status
24
21
  #
25
- # @param status_id [String, Integer, Croudia::Status]
26
- # @param params [Hash]
22
+ # @see https://developer.croudia.com/docs/52_favorites_create
23
+ # @param [String, Integer, Croudia::Status] status_id ID of the status to favorite
24
+ # @param [Hash] params Additional query parameters
25
+ # @option params [String] :include_entities Set false to exclude entities
27
26
  # @return [Croudia::Status] Favorited status
28
27
  def favorite(status_id, params={})
29
28
  status_id = get_id(status_id)
@@ -33,8 +32,10 @@ module Croudia
33
32
 
34
33
  # Unfavorite a status
35
34
  #
36
- # @param status_id [String, Integer, Croudia::Status]
37
- # @param params [Hash]
35
+ # @see https://developer.croudia.com/docs/53_favorites_destroy
36
+ # @param [String, Integer, Croudia::Status] status_id ID of the status to unfavorite
37
+ # @param [Hash] params Additional query parameters
38
+ # @option params [String] :include_entities Set false to exclude entities
38
39
  # @return [Croudia::Status] Unfavorited status
39
40
  def unfavorite(status_id, params={})
40
41
  status_id = get_id(status_id)
@@ -7,8 +7,14 @@ module Croudia
7
7
  module Friendships
8
8
  # Follow a user
9
9
  #
10
- # @param user [String. Integer, Croudia::User]
11
- # @param params [Hash] Optional params
10
+ # @see https://developer.croudia.com/docs/41_friendships_create
11
+ # @overload follow(user, params={})
12
+ # @param [String, Integer, Croudia::User] user User to follow
13
+ # @param [Hash] params Additional query parameters
14
+ # @overload follow(params={})
15
+ # @param [Hash] params Query parameters
16
+ # @option params [String] :screen_name Screen name of user to follow
17
+ # @option params [String, Integer] :user_id ID of user to follow
12
18
  # @return [Croudia::User] Followed user
13
19
  def follow(user, params={})
14
20
  merge_user!(params, user)
@@ -18,8 +24,14 @@ module Croudia
18
24
 
19
25
  # Unfollow a user
20
26
  #
21
- # @param user [String, Integer, Croudia::User]
22
- # @param params
27
+ # @see https://developer.croudia.com/docs/42_friendships_destroy
28
+ # @overload unfollow(user, params={})
29
+ # @param [String, Integer, Croudia::User] user User to unfollow
30
+ # @param [Hash] params Additional query parameters
31
+ # @overload unfollow(params={})
32
+ # @param [Hash] params Query parameters
33
+ # @option params [String] :screen_name Screen name of user to unfollow
34
+ # @option params [String, Integer] :user_id ID of user to unfollow
23
35
  # @return [Croudia::User] Unfollowed user
24
36
  def unfollow(user, params={})
25
37
  merge_user!(params, user)
@@ -29,9 +41,17 @@ module Croudia
29
41
 
30
42
  # Show relationship between two users
31
43
  #
32
- # @param source [String, Integer, Croudia::User]
33
- # @param target [String, Integer, Croudia::User]
34
- # @param params [Hash]
44
+ # @see https://developer.croudia.com/docs/44_friendships_show
45
+ # @overload friendship(source, target, params={})
46
+ # @param [String, Integer, Croudia::User] source Source of the relationship
47
+ # @param [String, Integer, Croudia::User] target Target of the relationship
48
+ # @param [Hash] params Additional query parameters
49
+ # @overload friendship(params={})
50
+ # @param [Hash] params Query parameters
51
+ # @option params [String, Integer] :source_id ID of the source user
52
+ # @option params [String] :source_screen_name Screen name of the source user
53
+ # @option params [String, Integer] :target_id ID of the target user
54
+ # @option params [String] :target_screen_name Screen name of the target user
35
55
  # @return [Croudia::Relationship]
36
56
  def friendship(source, target={}, params={})
37
57
  merge_user!(params, source, :source_screen_name, :source_id)
@@ -40,10 +60,16 @@ module Croudia
40
60
  Croudia::Relationship.new(resp)
41
61
  end
42
62
 
43
- # Lookup Friendships
63
+ # Lookup friendships between the current user and others
44
64
  #
45
- # @param *users [String, Integer, Croudia::User]
46
- # @param params [Hash]
65
+ # @see https://developer.croudia.com/docs/47_friendships_lookup
66
+ # @overload friendships(*users, params={})
67
+ # @param [String, Integer, Croudia::User] users Users to lookup friendships to them
68
+ # @param [Hash] params Additional query parameters
69
+ # @overload friendships(params={})
70
+ # @param [Hash] params Query parameters
71
+ # @option params [String] :screen_name Comma-separated screen names
72
+ # @option paramn [String] :user_id Comma-separated user IDs
47
73
  # @return [Array<Croudia::User>]
48
74
  def friendships(*args)
49
75
  merge_users!(params = {}, args)
@@ -53,9 +79,17 @@ module Croudia
53
79
 
54
80
  # Friend ids of specified user
55
81
  #
56
- # @param user [String, Integer, Croudia::User]
57
- # @param params [Hash]
58
- # @return [Croudia::Cursor] Cursor object that contains friend ids
82
+ # @see https://developer.croudia.com/docs/48_friends_ids
83
+ # @overload friend_ids(user=current_user, params={})
84
+ # @param [String, Integer, Croudia::User] user User to look up friends of
85
+ # @param [Hash] params Additional query parameters
86
+ # @option params [String, Integer] :cursor Cursor number, -1 to get the first page
87
+ # @overload friend_ids(params={})
88
+ # @param [Hash] params Query parameters
89
+ # @option params [String, Integer] :cursor Cursor number, -1 to get the first page
90
+ # @option params [String] :screen_name Screen name of the user to look up friends of
91
+ # @option params [String, Integer] :user_id ID of the user to look up friends of
92
+ # @return [Croudia::Cursor<Integer>] Cursor object that contains friend ids
59
93
  def friend_ids(user=current_user, params={})
60
94
  merge_user!(params, user)
61
95
  resp = get('/friends/ids.json', params)
@@ -64,9 +98,17 @@ module Croudia
64
98
 
65
99
  # Follower ids of specified user
66
100
  #
67
- # @param user [String, Integer, Croudia::User]
68
- # @param params [Hash]
69
- # @return [Croudia::Cursor]
101
+ # @see https://developer.croudia.com/docs/49_followers_ids
102
+ # @overload follower_ids(user=current_user, params={})
103
+ # @param [String, Integer, Croudia::User] user User to look up followers of
104
+ # @param [Hash] params Additional query parameters
105
+ # @option params [String, Integer] :cursor Cursor number, -1 to get the first page
106
+ # @overload follower_ids(params={})
107
+ # @param [Hash] params Query parameters
108
+ # @option params [String, Integer] :cursor Cursor number, -1 to get the first page
109
+ # @option params [String] :screen_name Screen name of the user to look up followers of
110
+ # @option params [String, Integer] :user_id ID of the user to look up followers of
111
+ # @return [Croudia::Cursor<Integer>] Cursor object that contains follower ids
70
112
  def follower_ids(user=current_user, params={})
71
113
  merge_user!(params, user)
72
114
  resp = get('/followers/ids.json', params)
@@ -75,9 +117,19 @@ module Croudia
75
117
 
76
118
  # Friends of specified user
77
119
  #
78
- # @param user [String, Integer, Croudia::User]
79
- # @param params [Hash]
80
- # @return [Croudia::Cursor]
120
+ # @see https://developer.croudia.com/docs/40_friends_list
121
+ # @overload friends(user=current_user, params={})
122
+ # @param [String, Integer, Croudia::User] user User to look up friends of
123
+ # @param [Hash] params Additional query parameters
124
+ # @option params [String, Integer] :cursor Cursor number, -1 to get the first page
125
+ # @option params [String] :trim_user Set true to return compact user objects
126
+ # @overload friends(params={})
127
+ # @param [Hash] params Query parameters
128
+ # @option params [String, Integer] :cursor Cursor number, -1 to get the first page
129
+ # @option params [String] :screen_name Screen name of the user to look up friends of
130
+ # @option params [String] :trim_user Set true to return compact user objects
131
+ # @option params [String, Integer] :user_id ID of the user to look up friends of
132
+ # @return [Croudia::Cursor<Croudia::User>] Cursor object that contains friends
81
133
  def friends(user=current_user, params={})
82
134
  merge_user!(params, user)
83
135
  resp = get('/friends/list.json', params)
@@ -86,9 +138,19 @@ module Croudia
86
138
 
87
139
  # Followers of specified user
88
140
  #
89
- # @param user [String, Integer, Croudia::User]
90
- # @param params [Hash]
91
- # @return [Croudia::Cursor]
141
+ # @see https://developer.croudia.com/docs/43_followers_list
142
+ # @overload followers(user=current_user, params={})
143
+ # @param [String, Integer, Croudia::User] user User to look up followers of
144
+ # @param [Hash] params Additional query parameters
145
+ # @option params [String, Integer] :cursor Cursor number, -1 to get the first page
146
+ # @option params [String] :trim_user Set true to return compact user objects
147
+ # @overload followers(params={})
148
+ # @param [Hash] params Query parameters
149
+ # @option params [String, Integer] :cursor Cursor number, -1 to get the first page
150
+ # @option params [String] :screen_name Screen name of the user to look up followers of
151
+ # @option params [String] :trim_user Set true to return compact user objects
152
+ # @option params [String, Integer] :user_id ID of the user to look up followers of
153
+ # @return [Croudia::Cursor<Croudia::User>] Cursor object that contains followers
92
154
  def followers(user=current_user, params={})
93
155
  merge_user!(params, user)
94
156
  resp = get('/followers/list.json', params)
@@ -5,7 +5,12 @@ module Croudia
5
5
  module OAuth
6
6
  # Authorize URL
7
7
  #
8
- # @return authorize_url [String]
8
+ # @see https://developer.croudia.com/docs/oauth
9
+ # @param [Hash] params Query parameters
10
+ # @option params [String] :client_id (@client_id) OAuth client ID
11
+ # @option params [String] :response_type ("code") OAuth response type
12
+ # @option params [String] :state
13
+ # @return [String] Authorize URL
9
14
  def authorize_url(params={})
10
15
  params[:client_id] ||= @client_id
11
16
  params[:response_type] ||= 'code'
@@ -14,9 +19,20 @@ module Croudia
14
19
 
15
20
  # Retrieve access_token
16
21
  #
17
- # @param code [String] Authorize code passed from user
18
- # @params params [Hash] Additional params
19
- # @return access_token [Hash]
22
+ # @see https://developer.croudia.com/docs/oauth
23
+ # @overload get_access_token(code, params={})
24
+ # @param [String] code Authorize code passed from user
25
+ # @param [Hash] params Additional query parameters
26
+ # @option params [String] :client_id (@client_id) OAuth client ID
27
+ # @option params [String] :client_secret (@client_secret) OAuth client secret
28
+ # @option params [String] :grant_type ("authorization_code") OAuth grant type
29
+ # @overload get_access_token(params={})
30
+ # @param [Hash] params Query parameters
31
+ # @option params [String] :client_id (@client_id) OAuth client ID
32
+ # @option params [String] :client_secret (@client_secret) OAuth client secret
33
+ # @option params [String] :code Code param passed from user
34
+ # @option params [String] :grant_type ("authorization_code") OAuth grant type
35
+ # @return [Croudia::AccessToken] Access token
20
36
  def get_access_token(code, params={})
21
37
  case code
22
38
  when String, Integer
@@ -6,8 +6,23 @@ module Croudia
6
6
  module Search
7
7
  # Search for statuses
8
8
  #
9
- # @param q [String] Search query
10
- # @param params [Hash] Optional params
9
+ # @see https://developer.croudia.com/docs/81_search
10
+ # @overload search(q, params={})
11
+ # @param [String] q Search query
12
+ # @param [Hash] params Additional query parameters
13
+ # @option params [String, Integer] :count Number of statuses in the response
14
+ # @option params [String] :include_entities Set false to exclude entities
15
+ # @option params [String, Integer] :max_id Paging parameter
16
+ # @option params [String, Integer] :since_id Paging parameter
17
+ # @option params [String] :trim_user Set true to return compact user objects
18
+ # @overload search(params={})
19
+ # @param [Hash] params Query parameters
20
+ # @option params [String] :q Search query
21
+ # @option params [String, Integer] :count Number of statuses in the response
22
+ # @option params [String] :include_entities Set false to exclude entities
23
+ # @option params [String, Integer] :max_id Paging parameter
24
+ # @option params [String, Integer] :since_id Paging parameter
25
+ # @option params [String] :trim_user Set true to return compact user objects
11
26
  # @return [Croudia::SearchResults]
12
27
  def search(q, params={})
13
28
  merge_query!(params, q)
@@ -17,14 +32,28 @@ module Croudia
17
32
 
18
33
  # Search for users
19
34
  #
20
- # @param q [String] Search query
21
- # @param params [Hash] Optional params
22
- # @return [Array<Croudia::User>]
35
+ # @see https://developer.croudia.com/docs/82_users_search
36
+ # @overload search_user(q, params={})
37
+ # @param [String] q Search query
38
+ # @param [Hash] params Additional query parameters
39
+ # @option params [String, Integer] :count Number of users in the response
40
+ # @option params [String] :include_entities Set false to exclude entities
41
+ # @option params [String, Integer] :max_id Paging parameter
42
+ # @option params [String, Integer] :since_id Paging parameter
43
+ # @option params [String] :trim_user Set true to return compact user objects
44
+ # @overload search_user(params={})
45
+ # @param [Hash] params Query parameters
46
+ # @option params [String] :q Search query
47
+ # @option params [String, Integer] :count Number of users in the response
48
+ # @option params [String, Integer] :page Page to fetch, up to 1000
49
+ # @option params [String] :trim_user Set true to return compact user objects
50
+ # @return [Array<Croudia::User>] Users found
23
51
  def search_user(q, params={})
24
52
  merge_query!(params, q)
25
53
  resp = get('/users/search.json', params)
26
54
  objects(Croudia::User, resp)
27
55
  end
56
+ alias search_users search_user
28
57
  end
29
58
  end
30
59
  end
@@ -5,8 +5,12 @@ module Croudia
5
5
  module SecretMails
6
6
  # Get incoming secret mails
7
7
  #
8
- # @param params [Hash]
9
- # @return [Array<Croudia::SecretMails>]
8
+ # @see https://developer.croudia.com/docs/21_secret_mails
9
+ # @param [Hash] params Additional query parameters
10
+ # @option params [String, Integer] :count Number of secret mails in the response
11
+ # @option params [String, Integer] :max_id Paging parameter
12
+ # @option params [String, Integer] :since_id Paging parameter
13
+ # @return [Array<Croudia::SecretMail>]
10
14
  def secret_mails(params={})
11
15
  resp = get('/secret_mails.json', params)
12
16
  objects(Croudia::SecretMail, resp)
@@ -14,7 +18,11 @@ module Croudia
14
18
 
15
19
  # Get outgoing secret mails
16
20
  #
17
- # @param params [Hash]
21
+ # @see https://developer.croudia.com/docs/22_secret_mails_sent
22
+ # @param [Hash] params Additional query parameters
23
+ # @option params [String, Integer] :count Number of secret mails in the response
24
+ # @option params [String, Integer] :max_id Paging parameter
25
+ # @option params [String, Integer] :since_id Paging parameter
18
26
  # @return [Array<Croudia::SecretMail>]
19
27
  def secret_mails_sent(params={})
20
28
  resp = get('/secret_mails/sent.json', params)
@@ -23,9 +31,17 @@ module Croudia
23
31
 
24
32
  # Send a new secret mail
25
33
  #
26
- # @param text [String] Message body
27
- # @param to_user [String, Integer, Croudia::User] Recipient user
28
- # @param params [Hash]
34
+ # @see https://developer.croudia.com/docs/23_secret_mails_new
35
+ # @overload send_secret_mail(text, to_user, params={})
36
+ # @param [String] text Message body
37
+ # @param [String, Integer, Croudia::User] to_user Recipient user
38
+ # @param [Hash] params Additional query parameters
39
+ # @overload send_secret_mail(params={})
40
+ # @param [Hash] params Query parameters
41
+ # @option params [String] :screen_name Screen name of the recipient
42
+ # @option params [String] :text Message body
43
+ # @option params [String, Integer] :user_id ID of the recipient
44
+ # @return [Croudia::SecretMail] Sent message
29
45
  def send_secret_mail(text, to_user={}, params={})
30
46
  merge_text!(params, text, :text)
31
47
  merge_user!(params, to_user)
@@ -36,9 +52,10 @@ module Croudia
36
52
 
37
53
  # Destroy a secret mail
38
54
  #
39
- # @param id [Integer, String, Croudia::SecretMail]
40
- # @param params [Hash]
41
- # @return [Croudia::SecretMail]
55
+ # @see https://developer.croudia.com/docs/24_secret_mails_destroy
56
+ # @param [String, Integer, Croudia::SecretMail] id ID of the secret mail to delete
57
+ # @param [Hash] params Additional query params
58
+ # @return [Croudia::SecretMail] Deleted secret mail
42
59
  def destroy_secret_mail(id, params={})
43
60
  resp = post("/secret_mails/destroy/#{get_id(id)}.json", params)
44
61
  Croudia::SecretMail.new(resp)
@@ -46,8 +63,9 @@ module Croudia
46
63
 
47
64
  # Get a secret mail
48
65
  #
49
- # @param id [Integer, String, Croudia::SecretMail]
50
- # @param params [Hash]
66
+ # @see https://developer.croudia.com/docs/25_secret_mails_show
67
+ # @param [String, Integer, Croudia::SecretMail] id ID of the secret mail to get
68
+ # @param [Hash] params Additional query parameters
51
69
  # @return [Croudia::SecretMail]
52
70
  def show_secret_mail(id, params={})
53
71
  resp = get("/secret_mails/show/#{get_id(id)}.json", params)