mastodon-api 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mastodon/entities/media.rb +3 -1
- data/lib/mastodon/rest/apps.rb +4 -2
- data/lib/mastodon/rest/relationships.rb +14 -0
- data/lib/mastodon/rest/timelines.rb +8 -7
- data/lib/mastodon/version.rb +1 -1
- data/mastodon.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 041943ed6a812cb1b332f5bc67d9578a1fe8ff1f
|
4
|
+
data.tar.gz: 5dd6f241c077678c79aa39a4943923bc02f8a5fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d94b3e4745d4b832b8c5a9b04c9422a3262e852c11483fad08460148bb6ee065bc4f3e9756d059ecfff6ed28dc589d14ca3c28e113e524aed55689d1a78804d
|
7
|
+
data.tar.gz: 43faaa2dcd228681f2d07c6be1155fcf84b78183f60f3f7503eec7223e0a96290a2f5b98102154d0c028a80fd553dd9491ad8a531cad2a61eef9c18f2c6968c4
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Mastodon
|
2
2
|
module Entities
|
3
3
|
class Media < Mastodon::Base
|
4
|
+
# @!attribute [r] id
|
5
|
+
# @return [Integer]
|
4
6
|
# @!attribute [r] url
|
5
7
|
# @return [String]
|
6
8
|
# @!attribute [r] preview_url
|
@@ -8,7 +10,7 @@ module Mastodon
|
|
8
10
|
# @!attribute [r] type
|
9
11
|
# @return [String]
|
10
12
|
|
11
|
-
normal_attr_reader :url, :preview_url, :type
|
13
|
+
normal_attr_reader :id, :url, :preview_url, :type
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
data/lib/mastodon/rest/apps.rb
CHANGED
@@ -9,9 +9,11 @@ module Mastodon
|
|
9
9
|
# Register a new OAuth client app on the target instance
|
10
10
|
# @param name [String]
|
11
11
|
# @param redirect_uri [String]
|
12
|
+
# @param scopes [String]
|
13
|
+
# @param website [String]
|
12
14
|
# @return [Mastodon::App]
|
13
|
-
def create_app(name, redirect_uri)
|
14
|
-
perform_request_with_object(:post, '/api/v1/apps', { client_name: name, redirect_uris: redirect_uri }, Mastodon::App)
|
15
|
+
def create_app(name, redirect_uri, scopes = 'read', website = nil)
|
16
|
+
perform_request_with_object(:post, '/api/v1/apps', { client_name: name, redirect_uris: redirect_uri, scopes: scopes, website: website }, Mastodon::App)
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -40,6 +40,20 @@ module Mastodon
|
|
40
40
|
def unblock(id)
|
41
41
|
perform_request_with_object(:post, "/api/v1/accounts/#{id}/unblock", {}, Mastodon::Relationship)
|
42
42
|
end
|
43
|
+
|
44
|
+
# Mute a user
|
45
|
+
# @param id [Integer]
|
46
|
+
# @return [Mastodon::Relationship]
|
47
|
+
def mute(id)
|
48
|
+
perform_request_with_object(:post, "/api/v1/accounts/#{id}/mute", {}, Mastodon::Relationship)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Unmute a user
|
52
|
+
# @param id [Integer]
|
53
|
+
# @return [Mastodon::Relationship]
|
54
|
+
def unmute(id)
|
55
|
+
perform_request_with_object(:post, "/api/v1/accounts/#{id}/unmute", {}, Mastodon::Relationship)
|
56
|
+
end
|
43
57
|
end
|
44
58
|
end
|
45
59
|
end
|
@@ -13,27 +13,28 @@ module Mastodon
|
|
13
13
|
# @option options :limit [Integer]
|
14
14
|
# @return [Mastodon::Collection<Mastodon::Status>]
|
15
15
|
def home_timeline(options = {})
|
16
|
-
perform_request_with_collection(:get, '/api/v1/
|
16
|
+
perform_request_with_collection(:get, '/api/v1/timelines/home', options, Mastodon::Status)
|
17
17
|
end
|
18
18
|
|
19
|
-
# Retrieve statuses from the
|
19
|
+
# Retrieve statuses from the public timeline
|
20
20
|
# @param options [Hash]
|
21
21
|
# @option options :max_id [Integer]
|
22
22
|
# @option options :since_id [Integer]
|
23
23
|
# @option options :limit [Integer]
|
24
24
|
# @return [Mastodon::Collection<Mastodon::Status>]
|
25
|
-
def
|
26
|
-
perform_request_with_collection(:get, '/api/v1/
|
25
|
+
def public_timeline(options = {})
|
26
|
+
perform_request_with_collection(:get, '/api/v1/timelines/public', options, Mastodon::Status)
|
27
27
|
end
|
28
28
|
|
29
|
-
# Retrieve statuses from
|
29
|
+
# Retrieve statuses from a hashtag
|
30
|
+
# @param hashtag [String]
|
30
31
|
# @param options [Hash]
|
31
32
|
# @option options :max_id [Integer]
|
32
33
|
# @option options :since_id [Integer]
|
33
34
|
# @option options :limit [Integer]
|
34
35
|
# @return [Mastodon::Collection<Mastodon::Status>]
|
35
|
-
def
|
36
|
-
perform_request_with_collection(:get,
|
36
|
+
def hashtag_timeline(hashtag, options = {})
|
37
|
+
perform_request_with_collection(:get, "/api/v1/timelines/tag/#{hashtag}", options, Mastodon::Status)
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
data/lib/mastodon/version.rb
CHANGED
data/mastodon.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'mastodon/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'mastodon-api'
|
7
7
|
spec.description = 'A ruby interface to the Mastodon API'
|
8
|
-
spec.homepage = 'https://github.com/
|
8
|
+
spec.homepage = 'https://github.com/tootsuite/mastodon-api'
|
9
9
|
spec.email = 'eugen@zeonfederated.com'
|
10
10
|
spec.authors = ['Eugen Rochko']
|
11
11
|
spec.summary = spec.description
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mastodon-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugen Rochko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -84,7 +84,7 @@ files:
|
|
84
84
|
- lib/mastodon/status.rb
|
85
85
|
- lib/mastodon/version.rb
|
86
86
|
- mastodon.gemspec
|
87
|
-
homepage: https://github.com/
|
87
|
+
homepage: https://github.com/tootsuite/mastodon-api
|
88
88
|
licenses:
|
89
89
|
- MIT
|
90
90
|
metadata: {}
|