misskey 0.0.7 → 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 +10 -5
  4. data/lib/misskey.rb +26 -4
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12cdd26d291399bb655e29df508ede911b5d6c64ad488015ee688834ced51b9e
4
- data.tar.gz: f7a4895cb2dc54a955c19bc3733d48163ce1cf55a88796c368821eaa54837785
3
+ metadata.gz: 05470ab46394381357fd5ca4809eb6dc8e81395b96943d296702a93df5f20485
4
+ data.tar.gz: 942f5282963f34b7c5a26584059d27ad3896cb21a230c6e7fdd171fe0362ec4b
5
5
  SHA512:
6
- metadata.gz: fec3df8b6da6d4cfe385eaabdad2d2d477df6b7b01974a94095f0cc0acb95ceb76c5bf22606502635f604e9aab1f58a379cbe425cd752251f8ff995b77f26130
7
- data.tar.gz: 021f47e613e88880b7ad058097c706cd0f12736832ec6d356f78dfadd3951ba1ed823cb318712580a6f73a6278984d1ee6f596314bc2186049327da6918b489a
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,
@@ -31,10 +32,14 @@ JSON
31
32
  puts postJSON
32
33
  puts response
33
34
  end
35
+
36
+ return response
34
37
  end
35
38
 
36
- def replied replyId, noteContent, visibility = "public", localOnly = false, cw = ""
39
+ def replied replyId, noteContent, visibility = "public", visibleUserIds = [], localOnly = false, cw = ""
40
+ visibility = visibility.strip
37
41
  instance = "https://#{Misskey.auth.instanceURI}/api/notes/create"
42
+ visibleUserIdsJSON = visibleUserIds.to_json
38
43
  note = Misskey.notes.show replyId
39
44
 
40
45
  if Misskey.debug.debugging
@@ -69,7 +74,7 @@ JSON
69
74
  visibilityId = 4
70
75
  end
71
76
 
72
- if visibilityId >> noteVisibilityId
77
+ if visibilityId.to_i < noteVisibilityId.to_i
73
78
  visibility = noteVisibility
74
79
 
75
80
  if Misskey.debug.debugging
@@ -88,7 +93,7 @@ JSON
88
93
  postJSON = <<~JSON
89
94
  {
90
95
  "visibility": "#{visibility}",
91
- "visibleUserIds": [],
96
+ "visibleUserIds": #{visibleUserIdsJSON},
92
97
  "cw": "#{cw}",
93
98
  "localOnly": #{localOnly},
94
99
  "reactionAcceptance": null,
data/lib/misskey.rb CHANGED
@@ -12,6 +12,28 @@ module Misskey
12
12
  @@token = nil
13
13
  @@instanceURI = nil
14
14
 
15
+ def users
16
+ def show userId
17
+ instance = "https://#{Misskey.auth.instanceURI}/api/users/show"
18
+
19
+ postJSON = <<EOF
20
+ {
21
+ "userId": "#{userId}"
22
+ }
23
+ EOF
24
+
25
+ request = HTTParty.post(
26
+ instance,
27
+ body: postJSON,
28
+ headers: {
29
+ "Content-Type" => "application/json"
30
+ }
31
+ )
32
+
33
+ return JSON.parse request.body
34
+ end
35
+ end
36
+
15
37
  def auth
16
38
  def token
17
39
  return @@token
@@ -41,12 +63,12 @@ module Misskey
41
63
  end
42
64
 
43
65
  def notes
44
- def create noteContent, visibility = "public", localOnly = false, cw = ""
45
- 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
46
68
  end
47
69
 
48
- def reply replyId, noteContent, visibility = "public", localOnly = false, cw = ""
49
- 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
50
72
  end
51
73
 
52
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.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sky.Bit