misskey 0.0.2 → 0.0.3

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +114 -0
  3. data/lib/misskey.rb +0 -6
  4. data/lib/websocket.rb +7 -0
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03e2e920853b80640240b7ad629a1f998b23df4369542f9d8a6e909a3883147d
4
- data.tar.gz: bd07e84986ca9e0d9807b5c3055c20c02ff9ec7ffe39e7388f5864cb0739af58
3
+ metadata.gz: 2c4008ac213ee40bf57c9755520e34002d91fa6f730e7fd0d316a71ec4d25aa5
4
+ data.tar.gz: aff4ba972e9212006a148beacda5673a0b689c9302194f748a65dba610ffb613
5
5
  SHA512:
6
- metadata.gz: dadffdeacd82c3244c69a5e00a41bad5ed2ef275de8169deb4d384459bdb1788a78f6b143d6e53b19b3aabda3fdcd9bf359a3cd734a66836c4f0f8859818b777
7
- data.tar.gz: e7e120302904faa5d1863bef0af94654a643f7788e0a4fc307a6a3897d59c2266361d3e14022dffdf165e14641d710887046cdf804d1b8c4e5a67f08af50d8ea
6
+ metadata.gz: 802c89d8a5645c7d4b4f7b40896be93a1b786227e8e7d90ddd3ca71e4489d8140d46388239b1e9a57bd67b5f06f9124861e47b3ff8f7d0bc8a31cfa41fa4c389
7
+ data.tar.gz: 7ccdc70381209c61f3165586bd99db68b5a0e99bb6eb73813a714099d28cc62c990efc0ebc2a22c651528879d9096ab47a1d2e469500d4b6a2af02d7358984be
data/README.md CHANGED
@@ -30,6 +30,8 @@ I didn't have the energy to make a real wiki for this and I have no idea how to
30
30
 
31
31
  Like I said in the contributing guide, this doesn't implement every Misskey API feature and if you want to see a feature added it would mean a lot to me if you could contribute! Thanks :neofox_heart:
32
32
 
33
+ All responses from the API are automatically parsed from JSON to a Ruby Array so you shouldn't need to worry about that.
34
+
33
35
  ### Authentication **(REQUIRED!!!)**
34
36
  #### `Misskey.auth.instanceURI`
35
37
  This sets the instance URI that your client will connect to. This and `Misskey.auth.token` are **required** when using Misskey.rb.
@@ -156,6 +158,8 @@ You may refer to the [Misskey API docs](https://sharkey.skydevs.me/api-doc#tag/n
156
158
  Retrieves the home timeline of the currently logged-in user I believe? Not too sure because I only tested it on a dummy account that doesn't follow anyone.
157
159
 
158
160
  There is one optional argument which is `limit`. As the name suggests, it sets a limit to how many notes should be retrieved. By default it's set to 10.
161
+
162
+ Here's an example:
159
163
  ```ruby
160
164
  require "misskey"
161
165
 
@@ -217,3 +221,113 @@ Misskey.auth.instanceURI = "sharkey.skydevs.me"
217
221
  puts Misskey.i
218
222
  ```
219
223
  You may refer to the [Misskey API docs](https://sharkey.skydevs.me/api-doc#tag/account/POST/i) for more info.
224
+
225
+ #### `Misskey.i.notifications`
226
+ Retrieves the currently logged-in user's notifications. Has one argument which is `limit`. By default, `limit` is set to 10. Here's an example
227
+ ```ruby
228
+ require "misskey"
229
+
230
+ Misskey.auth.token = "tokenwaaaaaaa"
231
+ Misskey.auth.instanceURI = "sharkey.skydevs.me"
232
+
233
+ puts Misskey.i.notifications
234
+ ```
235
+ You may refer to the [Misskey API docs](https://sharkey.skydevs.me/api-doc#tag/account/POST/i/notifications) for more info.
236
+
237
+ ### Websockets!! (THis is my favorite thing about this library :neofox_floof_cute:)
238
+ #### `Misskey.websocket.connect`
239
+ Connects your client to Misskey via the websocket protocol. Automatically runs in a separate thread. There is no documentation on websockets in the Misskey API docs but the JSON data it gives is in the same structure as doing a normal request to their documented API.
240
+
241
+ #### Notifications
242
+ ##### `Misskey.websocket.notifications.onMention`
243
+ Used with a block; runs said block with an argument contianing the message when you recieve a mention notification.
244
+
245
+ Example:
246
+ ```ruby
247
+ require "misskey"
248
+
249
+ Misskey.auth.token = "tokenwaaaaaaa"
250
+ Misskey.auth.instanceURI = "sharkey.skydevs.me"
251
+
252
+ Misskey.websocket.connect
253
+
254
+ Misskey.websocket.notifications.onMention do |message|
255
+ puts message
256
+ end
257
+ ```
258
+ In this example, `puts message` will print the message JSON data in the terminal when it recieves a mention.
259
+
260
+ ##### `Misskey.websocket.notifications.onReaction`
261
+ Used with a block; runs said block with an argument contianing the message when you recieve a reaction notification.
262
+
263
+ Example:
264
+ ```ruby
265
+ require "misskey"
266
+
267
+ Misskey.auth.token = "tokenwaaaaaaa"
268
+ Misskey.auth.instanceURI = "sharkey.skydevs.me"
269
+
270
+ Misskey.websocket.connect
271
+
272
+ Misskey.websocket.notifications.onReaction do |message|
273
+ puts message
274
+ end
275
+ ```
276
+ In this example, `puts message` will print the message JSON data in the terminal when it recieves a reaction.
277
+
278
+ ##### `Misskey.websocket.notifications.onRenote`
279
+ Used with a block; runs said block with an argument contianing the message when you recieve a renote notification.
280
+
281
+ Example:
282
+ ```ruby
283
+ require "misskey"
284
+
285
+ Misskey.auth.token = "tokenwaaaaaaa"
286
+ Misskey.auth.instanceURI = "sharkey.skydevs.me"
287
+
288
+ Misskey.websocket.connect
289
+
290
+ Misskey.websocket.notifications.onRenote do |message|
291
+ puts message
292
+ end
293
+ ```
294
+ In this example, `puts message` will print the message JSON data in the terminal when it recieves a renote.
295
+
296
+ ##### `Misskey.websocket.notifications.onNotification`
297
+ Used with a block; runs said block with an argument contianing the message when you recieve a notification.
298
+
299
+ Example:
300
+ ```ruby
301
+ require "misskey"
302
+
303
+ Misskey.auth.token = "tokenwaaaaaaa"
304
+ Misskey.auth.instanceURI = "sharkey.skydevs.me"
305
+
306
+ Misskey.websocket.connect
307
+
308
+ Misskey.websocket.notifications.onNotification do |message|
309
+ puts message
310
+ end
311
+ ```
312
+ In this example, `puts message` will print the message JSON data in the terminal when it recieves a notification.
313
+
314
+ ##### `Misskey.websocket.notifications.onQuote`
315
+ Used with a block; runs said block with an argument contianing the message when you recieve a quote notification.
316
+
317
+ Example:
318
+ ```ruby
319
+ require "misskey"
320
+
321
+ Misskey.auth.token = "tokenwaaaaaaa"
322
+ Misskey.auth.instanceURI = "sharkey.skydevs.me"
323
+
324
+ Misskey.websocket.connect
325
+
326
+ Misskey.websocket.notifications.onQuote do |message|
327
+ puts message
328
+ end
329
+ ```
330
+ In this example, `puts message` will print the message JSON data in the terminal when it recieves a quote.
331
+
332
+ ## That's all!
333
+ Those are all the features currently implemented, but don't worry, more will be added as time goes on :neofox_heart:
data/lib/misskey.rb CHANGED
@@ -11,12 +11,6 @@ include WS
11
11
  module Misskey
12
12
  @@token = nil
13
13
  @@instanceURI = nil
14
- @@onMentionDo = [false, nil]
15
- @@debugging = false
16
- @@onReactionDo = [false, nil]
17
- @@onRenoteDo = [false, nil]
18
- @@onNotificationDo = [false, nil]
19
- @@onQuoteDo = [false, nil]
20
14
 
21
15
  def auth
22
16
  def token
data/lib/websocket.rb CHANGED
@@ -1,4 +1,11 @@
1
1
  module WS
2
+ @@onMentionDo = [false, nil]
3
+ @@debugging = false
4
+ @@onReactionDo = [false, nil]
5
+ @@onRenoteDo = [false, nil]
6
+ @@onNotificationDo = [false, nil]
7
+ @@onQuoteDo = [false, nil]
8
+
2
9
  def c
3
10
  Thread.start do
4
11
  EM.run do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: misskey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sky.Bit