misskey 0.0.8 → 0.0.9

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 +16 -2
  3. data/lib/create.rb +8 -5
  4. data/lib/misskey.rb +4 -4
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1527fc06bdc69225e59d44b2242cee4e143da12c6820fb7bd60b723e0424a3f
4
- data.tar.gz: 0af3a1d1bb52423c1d24fdb61f66fe3d88feb72bfd325943587537c69fde1442
3
+ metadata.gz: 05470ab46394381357fd5ca4809eb6dc8e81395b96943d296702a93df5f20485
4
+ data.tar.gz: 942f5282963f34b7c5a26584059d27ad3896cb21a230c6e7fdd171fe0362ec4b
5
5
  SHA512:
6
- metadata.gz: 703fcc4f5c165c493a53f7814b49dfcee2136b64492c0b961a7b5267d735b4daa365cb237881236a279c455917621dd28f6b0cce9d6b37c560ebec7367e66ecb
7
- data.tar.gz: 0cd19ee3d233eea92ce8bfaa120a46f72df97d5cc6b5219203d930dbe3711fb8d166f2f4f750b809e596d60418f6ddc1023ae6ddc3107e813eb79d918b81e5f6
6
+ metadata.gz: 456c8e5cb1f8f6c58467496cf6e4f8ccf77ee4dedfc130fd5ea43dc1a2fdd7edaefcf47b7aaaf29fc40156a9e63f72bfabd295d83fac768aa9b22e0b2ba2fd9d
7
+ data.tar.gz: 47bb6e8913887cff049796fffbcb0791cdd445197ed30ea219bfab360cfde208ba9f66743be543e0a87d1b0651a2ca425bfa6bdf85b7c4aa27f422dbc47c2f5b
data/README.md CHANGED
@@ -94,7 +94,7 @@ Also pretty simple :neofox_floof_happy:
94
94
  #### `Misskey.notes.create`
95
95
  Creates a note.
96
96
 
97
- Order of arguments are as follows: `noteContent` also known as the body text (REQUIRED), `visibility`, `localonly`, `cw` also known as a content warning.
97
+ Order of arguments are as follows: `noteContent` also known as the body text (REQUIRED), `visibility`, `visibleUserIds`, `localonly`, `cw` also known as a content warning.
98
98
 
99
99
  Visibility options include: `public`, `home`, `followers`, and `specified`. `specified` is also known as a direct note or private message.
100
100
 
@@ -141,7 +141,7 @@ You may refer to the [Misskey API docs](https://sharkey.skydevs.me/api-doc#tag/n
141
141
  #### `Misskey.notes.reply`
142
142
  Very similar to `Misskey.notes.create` except it features a new required argument called `replyId`.
143
143
 
144
- Arguments for this are as follows: `replyId` (REQUIRED), `noteContent` (REQUIRED), visibility, localOnly, cw
144
+ Arguments for this are as follows: `replyId` (REQUIRED), `noteContent` (REQUIRED), `visibility`, `visibleUserIds`, `localOnly`, `cw`
145
145
 
146
146
  An example:
147
147
  ```ruby
@@ -377,5 +377,19 @@ require "misskey"
377
377
  Misskey.debug.debugging = true
378
378
  ```
379
379
 
380
+ ### Users
381
+ #### `Misskey.users.show`
382
+ Has one argument, `userId`. Returns all information about a specific user.
383
+
384
+ Example:
385
+ ```ruby
386
+ require "misskey"
387
+
388
+ Misskey.auth.token = "tokenwaaaaaaa"
389
+ Misskey.auth.instanceURI = "sharkey.skydevs.me"
390
+
391
+ puts Misskey.users.show "wagoowago"
392
+ ```
393
+
380
394
  ## That's all!
381
395
  Those are all the features currently implemented, but don't worry, more will be added as time goes on :neofox_heart:
data/lib/create.rb CHANGED
@@ -1,11 +1,12 @@
1
1
  module Creates
2
- def created noteContent, visibility = "public", localOnly = false, cw = ""
2
+ def created noteContent, visibility = "public", visibleUserIds = [], localOnly = false, cw = ""
3
3
  instance = "https://#{Misskey.auth.instanceURI}/api/notes/create"
4
+ visibleUserIdsJSON = visibleUserIds.to_json
4
5
  # Visibility: public, home, followers, specified
5
6
  postJSON = <<~JSON
6
7
  {
7
8
  "visibility": "#{visibility}",
8
- "visibleUserIds": [],
9
+ "visibleUserIds": #{visibleUserIdsJSON},
9
10
  "cw": "#{cw}",
10
11
  "localOnly": #{localOnly},
11
12
  "reactionAcceptance": null,
@@ -35,8 +36,10 @@ JSON
35
36
  return response
36
37
  end
37
38
 
38
- def replied replyId, noteContent, visibility = "public", localOnly = false, cw = ""
39
+ def replied replyId, noteContent, visibility = "public", visibleUserIds = [], localOnly = false, cw = ""
40
+ visibility = visibility.strip
39
41
  instance = "https://#{Misskey.auth.instanceURI}/api/notes/create"
42
+ visibleUserIdsJSON = visibleUserIds.to_json
40
43
  note = Misskey.notes.show replyId
41
44
 
42
45
  if Misskey.debug.debugging
@@ -71,7 +74,7 @@ JSON
71
74
  visibilityId = 4
72
75
  end
73
76
 
74
- if visibilityId >> noteVisibilityId
77
+ if visibilityId.to_i < noteVisibilityId.to_i
75
78
  visibility = noteVisibility
76
79
 
77
80
  if Misskey.debug.debugging
@@ -90,7 +93,7 @@ JSON
90
93
  postJSON = <<~JSON
91
94
  {
92
95
  "visibility": "#{visibility}",
93
- "visibleUserIds": [],
96
+ "visibleUserIds": #{visibleUserIdsJSON},
94
97
  "cw": "#{cw}",
95
98
  "localOnly": #{localOnly},
96
99
  "reactionAcceptance": null,
data/lib/misskey.rb CHANGED
@@ -63,12 +63,12 @@ EOF
63
63
  end
64
64
 
65
65
  def notes
66
- def create noteContent, visibility = "public", localOnly = false, cw = ""
67
- Creates.created noteContent, visibility = "public", localOnly = false, cw = ""
66
+ def create noteContent, visibility = "public", visibleUserIds = [], localOnly = false, cw = ""
67
+ Creates.created noteContent, visibility, visibleUserIds, localOnly, cw
68
68
  end
69
69
 
70
- def reply replyId, noteContent, visibility = "public", localOnly = false, cw = ""
71
- Creates.replied replyId, noteContent, visibility = "public", localOnly = false, cw = ""
70
+ def reply replyId, noteContent, visibility = "public", visibleUserIds = [], localOnly = false, cw = ""
71
+ Creates.replied replyId, noteContent, visibility, visibleUserIds, localOnly, cw
72
72
  end
73
73
 
74
74
  def timeline limit = 10
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.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sky.Bit