Class: Ayadn::Endpoints
- Inherits:
-
Object
- Object
- Ayadn::Endpoints
- Defined in:
- lib/ayadn/endpoints.rb
Instance Attribute Summary collapse
-
#ayadn_callback_url ⇒ Object
Returns the value of attribute ayadn_callback_url.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#channels_url ⇒ Object
Returns the value of attribute channels_url.
-
#config_api_url ⇒ Object
Returns the value of attribute config_api_url.
-
#files_url ⇒ Object
Returns the value of attribute files_url.
-
#pm_url ⇒ Object
Returns the value of attribute pm_url.
-
#posts_url ⇒ Object
Returns the value of attribute posts_url.
-
#token_url ⇒ Object
Returns the value of attribute token_url.
-
#users_url ⇒ Object
Returns the value of attribute users_url.
Instance Method Summary collapse
- #authorize_url ⇒ Object
- #ayadnlog ⇒ Object
- #block(username) ⇒ Object
- #blocked(options) ⇒ Object
- #channels(options) ⇒ Object
- #checkins(options) ⇒ Object
- #conversations(options) ⇒ Object
- #convo(post_id, options) ⇒ Object
- #delete_message(channel_id, message_id) ⇒ Object
- #delete_post(post_id) ⇒ Object
- #file(file_id) ⇒ Object
- #files ⇒ Object
- #files_list(options) ⇒ Object
- #follow(username) ⇒ Object
- #followers(username, options) ⇒ Object
- #followings(username, options) ⇒ Object
- #global(options) ⇒ Object
- #hashtag(hashtag) ⇒ Object
-
#initialize ⇒ Endpoints
constructor
A new instance of Endpoints.
- #interactions ⇒ Object
- #mentions(username, options) ⇒ Object
- #messages(channel_id, options) ⇒ Object
- #mute(username) ⇒ Object
- #muted(options) ⇒ Object
- #photos(options) ⇒ Object
- #posts(username, options) ⇒ Object
- #repost(post_id) ⇒ Object
- #search(words, options) ⇒ Object
- #search_annotations(anno, options) ⇒ Object
- #search_channels(words, options) ⇒ Object
- #search_messages(channel_id, words, options) ⇒ Object
- #search_users(words, options) ⇒ Object
- #single_post(post_id, options) ⇒ Object
- #star(post_id) ⇒ Object
- #token_info ⇒ Object
- #trending(options) ⇒ Object
- #unified(options) ⇒ Object
-
#user(username) ⇒ Object
accepts a string.
-
#users(usernames) ⇒ Object
accepts an array.
- #whatstarred(username, options) ⇒ Object
- #whoreposted(post_id) ⇒ Object
- #whostarred(post_id) ⇒ Object
Constructor Details
#initialize ⇒ Endpoints
Returns a new instance of Endpoints.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ayadn/endpoints.rb', line 7 def initialize @ayadn_callback_url = "http://aya.io/ayadn/auth.html" @base_url = "https://api.app.net/" @config_api_url = @base_url + "config" @posts_url = @base_url + "posts/" @users_url = @base_url + "users/" @files_url = @base_url + "files/" @token_url = @base_url + "token/" @channels_url = @base_url + "channels/" @pm_url = @channels_url + "pm/messages" end |
Instance Attribute Details
#ayadn_callback_url ⇒ Object
Returns the value of attribute ayadn_callback_url.
5 6 7 |
# File 'lib/ayadn/endpoints.rb', line 5 def ayadn_callback_url @ayadn_callback_url end |
#base_url ⇒ Object
Returns the value of attribute base_url.
5 6 7 |
# File 'lib/ayadn/endpoints.rb', line 5 def base_url @base_url end |
#channels_url ⇒ Object
Returns the value of attribute channels_url.
5 6 7 |
# File 'lib/ayadn/endpoints.rb', line 5 def channels_url @channels_url end |
#config_api_url ⇒ Object
Returns the value of attribute config_api_url.
5 6 7 |
# File 'lib/ayadn/endpoints.rb', line 5 def config_api_url @config_api_url end |
#files_url ⇒ Object
Returns the value of attribute files_url.
5 6 7 |
# File 'lib/ayadn/endpoints.rb', line 5 def files_url @files_url end |
#pm_url ⇒ Object
Returns the value of attribute pm_url.
5 6 7 |
# File 'lib/ayadn/endpoints.rb', line 5 def pm_url @pm_url end |
#posts_url ⇒ Object
Returns the value of attribute posts_url.
5 6 7 |
# File 'lib/ayadn/endpoints.rb', line 5 def posts_url @posts_url end |
#token_url ⇒ Object
Returns the value of attribute token_url.
5 6 7 |
# File 'lib/ayadn/endpoints.rb', line 5 def token_url @token_url end |
#users_url ⇒ Object
Returns the value of attribute users_url.
5 6 7 |
# File 'lib/ayadn/endpoints.rb', line 5 def users_url @users_url end |
Instance Method Details
#authorize_url ⇒ Object
19 20 21 |
# File 'lib/ayadn/endpoints.rb', line 19 def "https://account.app.net/oauth/authenticate?client_id=#{Settings::AYADN_CLIENT_ID}&response_type=token&redirect_uri=#{@ayadn_callback_url}&scope=basic,stream,write_post,follow,public_messages,messages,files,update_profile&include_marker=1" end |
#ayadnlog ⇒ Object
255 256 257 |
# File 'lib/ayadn/endpoints.rb', line 255 def ayadnlog "#{@channels_url}47348/messages?access_token=#{Settings.user_token}" end |
#block(username) ⇒ Object
235 236 237 |
# File 'lib/ayadn/endpoints.rb', line 235 def block(username) "#{@users_url}#{username}/block?access_token=#{Settings.user_token}" end |
#blocked(options) ⇒ Object
149 150 151 |
# File 'lib/ayadn/endpoints.rb', line 149 def blocked() "#{@users_url}me/blocked/?access_token=#{Settings.user_token}&count=#{[:count]}&before_id=#{[:before_id]}" end |
#channels(options) ⇒ Object
247 248 249 |
# File 'lib/ayadn/endpoints.rb', line 247 def channels() "#{@channels_url}?access_token=#{Settings.user_token}#{API.build_query()}" end |
#checkins(options) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/ayadn/endpoints.rb', line 44 def checkins() @options_list = if [:count] || [:since_id] API.build_query() else API.build_query({count: Settings.[:counts][:checkins]}) end "#{@posts_url}stream/explore/checkins?access_token=#{Settings.user_token}#{@options_list}" end |
#conversations(options) ⇒ Object
80 81 82 83 84 85 86 87 |
# File 'lib/ayadn/endpoints.rb', line 80 def conversations() @options_list = if [:count] || [:since_id] API.build_query() else API.build_query({count: Settings.[:counts][:conversations]}) end "#{@posts_url}stream/explore/conversations?access_token=#{Settings.user_token}#{@options_list}" end |
#convo(post_id, options) ⇒ Object
128 129 130 131 132 133 134 135 |
# File 'lib/ayadn/endpoints.rb', line 128 def convo(post_id, ) @options_list = if [:count] API.build_query() else API.build_query({count: Settings.[:counts][:convo]}) end "#{@posts_url}#{post_id}/replies/?access_token=#{Settings.user_token}#{@options_list}" end |
#delete_message(channel_id, message_id) ⇒ Object
223 224 225 |
# File 'lib/ayadn/endpoints.rb', line 223 def (channel_id, ) "#{@channels_url}/#{channel_id}/messages/#{}?access_token=#{Settings.user_token}" end |
#delete_post(post_id) ⇒ Object
219 220 221 |
# File 'lib/ayadn/endpoints.rb', line 219 def delete_post(post_id) "#{@posts_url}#{post_id}?access_token=#{Settings.user_token}" end |
#file(file_id) ⇒ Object
27 28 29 |
# File 'lib/ayadn/endpoints.rb', line 27 def file(file_id) "#{@files_url}#{file_id}?access_token=#{Settings.user_token}" end |
#files ⇒ Object
31 32 33 |
# File 'lib/ayadn/endpoints.rb', line 31 def files "#{@files_url}?access_token=#{Settings.user_token}" end |
#files_list(options) ⇒ Object
210 211 212 213 214 215 216 217 |
# File 'lib/ayadn/endpoints.rb', line 210 def files_list() @options_list = if [:count] API.build_query() else API.build_query({count: Settings.[:counts][:files]}) end "#{@users_url}me/files?access_token=#{Settings.user_token}#{@options_list}" end |
#follow(username) ⇒ Object
227 228 229 |
# File 'lib/ayadn/endpoints.rb', line 227 def follow(username) "#{@users_url}#{username}/follow?access_token=#{Settings.user_token}" end |
#followers(username, options) ⇒ Object
141 142 143 |
# File 'lib/ayadn/endpoints.rb', line 141 def followers(username, ) "#{@users_url}#{username}/followers/?access_token=#{Settings.user_token}&count=#{[:count]}&before_id=#{[:before_id]}" end |
#followings(username, options) ⇒ Object
137 138 139 |
# File 'lib/ayadn/endpoints.rb', line 137 def followings(username, ) "#{@users_url}#{username}/following/?access_token=#{Settings.user_token}&count=#{[:count]}&before_id=#{[:before_id]}" end |
#global(options) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/ayadn/endpoints.rb', line 53 def global() @options_list = if [:count] || [:since_id] API.build_query() else API.build_query({count: Settings.[:counts][:global]}) end "#{@posts_url}stream/global?access_token=#{Settings.user_token}#{@options_list}" end |
#hashtag(hashtag) ⇒ Object
153 154 155 |
# File 'lib/ayadn/endpoints.rb', line 153 def hashtag(hashtag) "#{@posts_url}tag/#{hashtag}" end |
#interactions ⇒ Object
116 117 118 |
# File 'lib/ayadn/endpoints.rb', line 116 def interactions "#{@users_url}me/interactions?access_token=#{Settings.user_token}" end |
#mentions(username, options) ⇒ Object
89 90 91 92 93 94 95 96 |
# File 'lib/ayadn/endpoints.rb', line 89 def mentions(username, ) @options_list = if [:count] API.build_query() else API.build_query({count: Settings.[:counts][:mentions]}) end "#{@users_url}#{username}/mentions/?access_token=#{Settings.user_token}#{@options_list}" end |
#messages(channel_id, options) ⇒ Object
251 252 253 |
# File 'lib/ayadn/endpoints.rb', line 251 def (channel_id, ) "#{@channels_url}#{channel_id}/messages?access_token=#{Settings.user_token}#{API.build_query()}&include_machine=1" end |
#mute(username) ⇒ Object
231 232 233 |
# File 'lib/ayadn/endpoints.rb', line 231 def mute(username) "#{@users_url}#{username}/mute?access_token=#{Settings.user_token}" end |
#muted(options) ⇒ Object
145 146 147 |
# File 'lib/ayadn/endpoints.rb', line 145 def muted() "#{@users_url}me/muted/?access_token=#{Settings.user_token}&count=#{[:count]}&before_id=#{[:before_id]}" end |
#photos(options) ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'lib/ayadn/endpoints.rb', line 71 def photos() @options_list = if [:count] || [:since_id] API.build_query() else API.build_query({count: Settings.[:counts][:photos]}) end "#{@posts_url}stream/explore/photos?access_token=#{Settings.user_token}#{@options_list}" end |
#posts(username, options) ⇒ Object
98 99 100 101 102 103 104 105 |
# File 'lib/ayadn/endpoints.rb', line 98 def posts(username, ) @options_list = if [:count] API.build_query() else API.build_query({count: Settings.[:counts][:posts]}) end "#{@users_url}#{username}/posts/?access_token=#{Settings.user_token}#{@options_list}" end |
#repost(post_id) ⇒ Object
239 240 241 |
# File 'lib/ayadn/endpoints.rb', line 239 def repost(post_id) "#{@posts_url}#{post_id}/repost?access_token=#{Settings.user_token}" end |
#search(words, options) ⇒ Object
157 158 159 160 161 162 163 164 |
# File 'lib/ayadn/endpoints.rb', line 157 def search(words, ) @options_list = if [:count] API.build_query() else API.build_query({count: Settings.[:counts][:search]}) end "#{@posts_url}search?text=#{words}&access_token=#{Settings.user_token}#{@options_list}" end |
#search_annotations(anno, options) ⇒ Object
175 176 177 178 179 180 181 182 |
# File 'lib/ayadn/endpoints.rb', line 175 def search_annotations anno, @options_list = if [:count] API.build_query() else API.build_query({count: Settings.[:counts][:search]}) end "#{@posts_url}search?annotation_types=#{anno}&access_token=#{Settings.user_token}#{@options_list}" end |
#search_channels(words, options) ⇒ Object
193 194 195 196 |
# File 'lib/ayadn/endpoints.rb', line 193 def search_channels words, @options_list = API.build_query({count: Settings.[:counts][:search]}) "#{@channels_url}search?q=#{words}&order=popularity&access_token=#{Settings.user_token}#{@options_list}" end |
#search_messages(channel_id, words, options) ⇒ Object
184 185 186 187 188 189 190 191 |
# File 'lib/ayadn/endpoints.rb', line 184 def channel_id, words, @options_list = if [:count] API.build_query() else API.build_query({count: Settings.[:counts][:search]}) end "#{@channels_url}messages/search?query=#{words}&channel_ids=#{channel_id}&access_token=#{Settings.user_token}#{@options_list}" end |
#search_users(words, options) ⇒ Object
166 167 168 169 170 171 172 173 |
# File 'lib/ayadn/endpoints.rb', line 166 def search_users words, @options_list = if [:count] API.build_query() else API.build_query({count: Settings.[:counts][:search]}) end "#{@users_url}search?q=#{words}&access_token=#{Settings.user_token}#{@options_list}" end |
#single_post(post_id, options) ⇒ Object
206 207 208 |
# File 'lib/ayadn/endpoints.rb', line 206 def single_post(post_id, ) "#{@posts_url}#{post_id}?access_token=#{Settings.user_token}#{API.build_query()}" end |
#star(post_id) ⇒ Object
243 244 245 |
# File 'lib/ayadn/endpoints.rb', line 243 def star(post_id) "#{@posts_url}#{post_id}/star?access_token=#{Settings.user_token}" end |
#token_info ⇒ Object
23 24 25 |
# File 'lib/ayadn/endpoints.rb', line 23 def token_info "#{@token_url}?access_token=#{Settings.user_token}" end |
#trending(options) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/ayadn/endpoints.rb', line 62 def trending() @options_list = if [:count] || [:since_id] API.build_query() else API.build_query({count: Settings.[:counts][:trending]}) end "#{@posts_url}stream/explore/trending?access_token=#{Settings.user_token}#{@options_list}" end |
#unified(options) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/ayadn/endpoints.rb', line 35 def unified() @options_list = if [:count] || [:since_id] API.build_query() else API.build_query({count: Settings.[:counts][:unified]}) end "#{@posts_url}stream/unified?access_token=#{Settings.user_token}#{@options_list}" end |
#user(username) ⇒ Object
accepts a string
198 199 200 |
# File 'lib/ayadn/endpoints.rb', line 198 def user(username) # accepts a string "#{@users_url}#{username}?access_token=#{Settings.user_token}&include_user_annotations=1" end |
#users(usernames) ⇒ Object
accepts an array
202 203 204 |
# File 'lib/ayadn/endpoints.rb', line 202 def users(usernames) # accepts an array "#{@users_url}?ids=#{usernames.join(',')}?access_token=#{Settings.user_token}&include_user_annotations=1" end |
#whatstarred(username, options) ⇒ Object
107 108 109 110 111 112 113 114 |
# File 'lib/ayadn/endpoints.rb', line 107 def whatstarred(username, ) @options_list = if [:count] API.build_query() else API.build_query({count: Settings.[:counts][:default]}) end "#{@users_url}#{username}/stars/?access_token=#{Settings.user_token}#{@options_list}" end |
#whoreposted(post_id) ⇒ Object
120 121 122 |
# File 'lib/ayadn/endpoints.rb', line 120 def whoreposted(post_id) "#{@posts_url}#{post_id}/reposters/?access_token=#{Settings.user_token}" end |
#whostarred(post_id) ⇒ Object
124 125 126 |
# File 'lib/ayadn/endpoints.rb', line 124 def whostarred(post_id) "#{@posts_url}#{post_id}/stars/?access_token=#{Settings.user_token}" end |