Skip to content

Commit 4e75bec

Browse files
committed
Bring API support up to date
1 parent 189deb8 commit 4e75bec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+959
-210
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ notifications:
55
email: false
66

77
rvm:
8-
- 2.1
9-
- 2.2
108
- 2.3
119
- 2.4
1210
- 2.5

CHANGELOG.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
Changelog
2+
=========
3+
4+
All notable changes to this project will be documented in this file.
5+
6+
## [2.0.0] - 2019-01-29
7+
### Added
8+
9+
- Add `Mastodon::REST::Client#scheduled_statuses`
10+
- Add `Mastodon::REST::Client#scheduled_status`
11+
- Add `Mastodon::REST::Client#update_scheduled_status`
12+
- Add `Mastodon::REST::Client#delete_scheduled_status`
13+
- Add `Mastodon::REST::Client#create_report`
14+
- Add `Mastodon::REST::Client#mutes`
15+
- Add `Mastodon::REST::Client#blocks`
16+
- Add `Mastodon::REST::Client#mute_status`
17+
- Add `Mastodon::REST::Client#unmute_status`
18+
- Add `Mastodon::REST::Client#follow_requests`
19+
- Add `Mastodon::REST::Client#authorize_follow_request`
20+
- Add `Mastodon::REST::Client#reject_follow_request`
21+
- Add `Mastodon::REST::Client#dismiss_notification`
22+
- Add `Mastodon::REST::Client#clear_notifications`
23+
- Add `Mastodon::REST::Client#lists`
24+
- Add `Mastodon::REST::Client#list`
25+
- Add `Mastodon::REST::Client#create_list`
26+
- Add `Mastodon::REST::Client#update_list`
27+
- Add `Mastodon::REST::Client#delete_list`
28+
- Add `Mastodon::REST::Client#list_accounts`
29+
- Add `Mastodon::REST::Client#add_accounts_to_list`
30+
- Add `Mastodon::REST::Client#remove_accounts_from_list`
31+
- Add `Mastodon::REST::Client#activity`
32+
- Add `Mastodon::REST::Client#peers`
33+
- Add `Mastodon::REST::Client#filters`
34+
- Add `Mastodon::REST::Client#filter`
35+
- Add `Mastodon::REST::Client#create_filter`
36+
- Add `Mastodon::REST::Client#update_filter`
37+
- Add `Mastodon::REST::Client#delete_filter`
38+
- Add `Mastodon::REST::Client#endorsements`
39+
- Add `Mastodon::REST::Client#endorse`
40+
- Add `Mastodon::REST::Client#unendorse`
41+
- Add `Mastodon::REST::Client#domain_blocks`
42+
- Add `Mastodon::REST::Client#block_domain`
43+
- Add `Mastodon::REST::Client#unblock_domain`
44+
- Add `Mastodon::REST::Client#custom_emojis`
45+
- Add `Mastodon::REST::Client#conversations`
46+
- Add `Mastodon::REST::Client#mark_conversation_as_read`
47+
- Add `Mastodon::REST::Client#delete_conversation`
48+
- Add `Mastodon::REST::Client#verify_app_credentials`
49+
- Add `Mastodon::REST::Client#create_account`
50+
- Add `Mastodon::REST::Client#search_accounts`
51+
- Add `Mastodon::REST::Client#pin`
52+
- Add `Mastodon::REST::Client#unpin`
53+
- Add `Mastodon::REST::Client#delete_suggestion`
54+
- Add `Mastodon::REST::Client#list_timeline`
55+
- Add `card` to `Mastodon::Status`
56+
- Add `bot?`, `emojis`, `fields` to `Mastodon::Account`
57+
- Add `visible_in_picker` to `Mastodon::Emoji`
58+
- Add `stats`, `languages`, `contact_account` to `Mastodon::Instance`
59+
- Add `showing_reblogs?`, `endorsed?` to `Mastodon::Relationship`
60+
- Add `Mastodon::Streaming::Client#direct`
61+
- Add support for `conversation` and `filters_changed` events in streams
62+
63+
### Changed
64+
65+
- Change method signature of `Mastodon::REST::Client#create_status`
66+
- Change method signature of `Mastodon::REST::Client#upload_media`
67+
- Change method signature of `Mastodon::REST::Client#update_media`
68+
- Change type of `:avatar` and `:header` params in `Mastodon::REST::Client#update_credentials`
69+
- Rename `Mastodon::Streaming::DeletedStatus` to `Mastodon::Streaming::Events::StatusDelete`
70+
- Change `Mastodon::REST::Client#search` to use the v2 version of the API
71+
- Change `Mastodon::Results#hashtags` to be a collection of `Mastodon::Hashtag`
72+
- Rename `Mastodon::Streaming::Client#firehose` to `Mastodon::Streaming::Client#public`
73+
74+
### Removed
75+
76+
- Remove `Mastodon::REST::Client#follow_by_uri`

Gemfile.lock

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,99 @@
11
PATH
22
remote: .
33
specs:
4-
mastodon-api (1.2.0)
5-
addressable (~> 2.5)
6-
buftok
7-
http (~> 3.0)
8-
oj (~> 3.3)
4+
mastodon-api (2.0.0)
5+
addressable (~> 2.6)
6+
buftok (~> 0)
7+
http (~> 3.3)
8+
oj (~> 3.7)
99

1010
GEM
1111
remote: https://rubygems.org/
1212
specs:
13-
addressable (2.5.2)
13+
addressable (2.6.0)
1414
public_suffix (>= 2.0.2, < 4.0)
15-
ast (2.3.0)
15+
ast (2.4.0)
1616
buftok (0.2.0)
1717
coderay (1.1.2)
1818
crack (0.4.3)
1919
safe_yaml (~> 1.0.0)
2020
diff-lcs (1.3)
21-
docile (1.1.5)
22-
domain_name (0.5.20170404)
21+
docile (1.3.1)
22+
domain_name (0.5.20180417)
2323
unf (>= 0.0.5, < 1.0.0)
24-
fuubar (2.3.1)
24+
fuubar (2.3.2)
2525
rspec-core (~> 3.0)
2626
ruby-progressbar (~> 1.4)
27-
hashdiff (0.3.7)
28-
http (3.0.0)
27+
hashdiff (0.3.8)
28+
http (3.3.0)
2929
addressable (~> 2.3)
3030
http-cookie (~> 1.0)
31-
http-form_data (>= 2.0.0.pre.pre2, < 3)
31+
http-form_data (~> 2.0)
3232
http_parser.rb (~> 0.6.0)
3333
http-cookie (1.0.3)
3434
domain_name (~> 0.5)
35-
http-form_data (2.0.0)
35+
http-form_data (2.1.1)
3636
http_parser.rb (0.6.0)
37+
jaro_winkler (1.5.2)
3738
json (2.1.0)
38-
method_source (0.9.0)
39-
oj (3.3.10)
40-
parallel (1.12.1)
41-
parser (2.4.0.2)
42-
ast (~> 2.3)
43-
powerpack (0.1.1)
44-
pry (0.11.3)
39+
method_source (0.9.2)
40+
oj (3.7.8)
41+
parallel (1.13.0)
42+
parser (2.6.0.0)
43+
ast (~> 2.4.0)
44+
powerpack (0.1.2)
45+
pry (0.12.2)
4546
coderay (~> 1.1.0)
4647
method_source (~> 0.9.0)
47-
public_suffix (3.0.1)
48+
public_suffix (3.0.3)
4849
rainbow (3.0.0)
49-
rake (12.3.0)
50-
rspec (3.7.0)
51-
rspec-core (~> 3.7.0)
52-
rspec-expectations (~> 3.7.0)
53-
rspec-mocks (~> 3.7.0)
54-
rspec-core (3.7.1)
55-
rspec-support (~> 3.7.0)
56-
rspec-expectations (3.7.0)
50+
rake (12.3.2)
51+
rspec (3.8.0)
52+
rspec-core (~> 3.8.0)
53+
rspec-expectations (~> 3.8.0)
54+
rspec-mocks (~> 3.8.0)
55+
rspec-core (3.8.0)
56+
rspec-support (~> 3.8.0)
57+
rspec-expectations (3.8.2)
5758
diff-lcs (>= 1.2.0, < 2.0)
58-
rspec-support (~> 3.7.0)
59-
rspec-mocks (3.7.0)
59+
rspec-support (~> 3.8.0)
60+
rspec-mocks (3.8.0)
6061
diff-lcs (>= 1.2.0, < 2.0)
61-
rspec-support (~> 3.7.0)
62-
rspec-support (3.7.0)
63-
rubocop (0.52.1)
62+
rspec-support (~> 3.8.0)
63+
rspec-support (3.8.0)
64+
rubocop (0.63.1)
65+
jaro_winkler (~> 1.5.1)
6466
parallel (~> 1.10)
65-
parser (>= 2.4.0.2, < 3.0)
67+
parser (>= 2.5, != 2.5.1.1)
6668
powerpack (~> 0.1)
6769
rainbow (>= 2.2.2, < 4.0)
6870
ruby-progressbar (~> 1.7)
69-
unicode-display_width (~> 1.0, >= 1.0.1)
70-
ruby-progressbar (1.9.0)
71+
unicode-display_width (~> 1.4.0)
72+
ruby-progressbar (1.10.0)
7173
safe_yaml (1.0.4)
72-
simplecov (0.15.1)
73-
docile (~> 1.1.0)
74+
simplecov (0.16.1)
75+
docile (~> 1.1)
7476
json (>= 1.8, < 3)
7577
simplecov-html (~> 0.10.0)
7678
simplecov-html (0.10.2)
7779
timecop (0.9.1)
7880
unf (0.1.4)
7981
unf_ext
80-
unf_ext (0.0.7.4)
81-
unicode-display_width (1.3.0)
82-
webmock (3.2.1)
82+
unf_ext (0.0.7.5)
83+
unicode-display_width (1.4.1)
84+
webmock (3.5.1)
8385
addressable (>= 2.3.6)
8486
crack (>= 0.3.2)
8587
hashdiff
86-
yard (0.9.12)
88+
yard (0.9.18)
8789
yardstick (0.9.9)
8890
yard (~> 0.8, >= 0.8.7.2)
8991

9092
PLATFORMS
9193
ruby
9294

9395
DEPENDENCIES
94-
bundler (~> 1.0)
96+
bundler (~> 1.7)
9597
fuubar
9698
mastodon-api!
9799
pry

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ Mastodon API Ruby Gem
33

44
[![Gem Version](http://img.shields.io/gem/v/mastodon-api.svg)][gem]
55
[![Build Status](http://img.shields.io/travis/tootsuite/mastodon-api.svg)][travis]
6-
[![Dependency Status](http://img.shields.io/gemnasium/tootsuite/mastodon-api.svg)][gemnasium]
76

87
[gem]: https://rubygems.org/gems/mastodon-api
98
[travis]: https://travis-ci.org/tootsuite/mastodon-api
10-
[gemnasium]: https://gemnasium.com/tootsuite/mastodon-api
119

1210
A ruby interface for the [Mastodon](https://github.com/tootsuite/mastodon) API.
1311

lib/mastodon/access_token.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module Mastodon
2+
class AccessToken < Mastodon::Base
3+
# @!attribute [r] access_token
4+
# @return [String]
5+
# @!attribute [r] token_type
6+
# @return [String]
7+
# @!attribute [r] scope
8+
# @return [String]
9+
# @!attribute [r] created_at
10+
# @return [String]
11+
normal_attr_reader :access_token,
12+
:token_type,
13+
:scope,
14+
:created_at
15+
16+
def initialize(attributes = {})
17+
attributes.fetch('access_token')
18+
super
19+
end
20+
end
21+
end

lib/mastodon/account.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
require 'mastodon/emoji'
2+
require 'mastodon/field'
3+
14
module Mastodon
25
class Account < Mastodon::Base
36
# @!attribute [r] id
@@ -30,8 +33,14 @@ class Account < Mastodon::Base
3033
# @return [String]
3134
# @!attribute [r] locked?
3235
# @return [Boolean]
36+
# @!attribute [r] bot?
37+
# @return [Boolean]
3338
# @!attribute [r] moved
3439
# @return [Mastodon::Account]
40+
# @!attribute [r] emojis
41+
# @return [Mastodon::Collection<Mastodon::Emoji>]
42+
# @!attribute [r] fields
43+
# @return [Mastodon::Collection<Mastodon::Field>]
3544

3645
normal_attr_reader :id,
3746
:username,
@@ -48,10 +57,14 @@ class Account < Mastodon::Base
4857
:following_count,
4958
:statuses_count
5059

51-
predicate_attr_reader :locked
60+
predicate_attr_reader :locked,
61+
:bot
5262

5363
object_attr_reader :moved, Mastodon::Account
5464

65+
collection_attr_reader :emojis, Mastodon::Emoji
66+
collection_attr_reader :fields, Mastodon::Field
67+
5568
def initialize(attributes = {})
5669
attributes.fetch('id')
5770
super

lib/mastodon/card.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Card < Mastodon::Base
2929
:title,
3030
:description,
3131
:image,
32-
:type
32+
:type,
3333
:author_name,
3434
:author_url,
3535
:provider_name,

lib/mastodon/conversation.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require 'mastodon/account'
2+
require 'mastodon/status'
3+
4+
module Mastodon
5+
class Conversation < Mastodon::Base
6+
# @!attribute [r] id
7+
# @return [String]
8+
# @!attribute [r] unread?
9+
# @return [Boolean]
10+
# @!attribute [r] accounts
11+
# @return [Mastodon::Collection<Mastodon::Account>]
12+
# @!attribute [r] last_status
13+
# @return [Mastodon::Status]
14+
15+
normal_attr_reader :id
16+
predicate_attr_reader :unread
17+
collection_attr_reader :accounts, Mastodon::Account
18+
object_attr_reader :last_status, Mastodon::Status
19+
20+
def initialize(attributes = {})
21+
attributes.fetch('id')
22+
super
23+
end
24+
end
25+
end

lib/mastodon/emoji.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ class Emoji < Mastodon::Base
66
# @return [String]
77
# @!attribute [r] url
88
# @return [String]
9+
# @!attribute [r] visible_in_picker?
10+
# @return [Boolean]
911

1012
normal_attr_reader :shortcode, :static_url, :url
13+
14+
predicate_attr_reader :visible_in_picker
15+
16+
def initialize(attributes = {})
17+
attributes.fetch('shortcode')
18+
super
19+
end
1120
end
1221
end

lib/mastodon/field.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module Mastodon
2+
class Field < Mastodon::Base
3+
# @!attribute [r] name
4+
# @return [String]
5+
# @!attribute [r] value
6+
# @return [String]
7+
# @!attribute [r] verified_at
8+
# @return [String]
9+
10+
normal_attr_reader :name, :value, :verified_at
11+
12+
# Is this field a verified link?
13+
# @return [Boolean]
14+
def verified?
15+
attributes['verified_at'].present?
16+
end
17+
end
18+
end

0 commit comments

Comments
 (0)