Skip to content

Commit

Permalink
Bring API support up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Jan 29, 2019
1 parent 189deb8 commit 4e75bec
Show file tree
Hide file tree
Showing 54 changed files with 959 additions and 210 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ notifications:
email: false

rvm:
- 2.1
- 2.2
- 2.3
- 2.4
- 2.5
Expand Down
76 changes: 76 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Changelog
=========

All notable changes to this project will be documented in this file.

## [2.0.0] - 2019-01-29
### Added

- Add `Mastodon::REST::Client#scheduled_statuses`
- Add `Mastodon::REST::Client#scheduled_status`
- Add `Mastodon::REST::Client#update_scheduled_status`
- Add `Mastodon::REST::Client#delete_scheduled_status`
- Add `Mastodon::REST::Client#create_report`
- Add `Mastodon::REST::Client#mutes`
- Add `Mastodon::REST::Client#blocks`
- Add `Mastodon::REST::Client#mute_status`
- Add `Mastodon::REST::Client#unmute_status`
- Add `Mastodon::REST::Client#follow_requests`
- Add `Mastodon::REST::Client#authorize_follow_request`
- Add `Mastodon::REST::Client#reject_follow_request`
- Add `Mastodon::REST::Client#dismiss_notification`
- Add `Mastodon::REST::Client#clear_notifications`
- Add `Mastodon::REST::Client#lists`
- Add `Mastodon::REST::Client#list`
- Add `Mastodon::REST::Client#create_list`
- Add `Mastodon::REST::Client#update_list`
- Add `Mastodon::REST::Client#delete_list`
- Add `Mastodon::REST::Client#list_accounts`
- Add `Mastodon::REST::Client#add_accounts_to_list`
- Add `Mastodon::REST::Client#remove_accounts_from_list`
- Add `Mastodon::REST::Client#activity`
- Add `Mastodon::REST::Client#peers`
- Add `Mastodon::REST::Client#filters`
- Add `Mastodon::REST::Client#filter`
- Add `Mastodon::REST::Client#create_filter`
- Add `Mastodon::REST::Client#update_filter`
- Add `Mastodon::REST::Client#delete_filter`
- Add `Mastodon::REST::Client#endorsements`
- Add `Mastodon::REST::Client#endorse`
- Add `Mastodon::REST::Client#unendorse`
- Add `Mastodon::REST::Client#domain_blocks`
- Add `Mastodon::REST::Client#block_domain`
- Add `Mastodon::REST::Client#unblock_domain`
- Add `Mastodon::REST::Client#custom_emojis`
- Add `Mastodon::REST::Client#conversations`
- Add `Mastodon::REST::Client#mark_conversation_as_read`
- Add `Mastodon::REST::Client#delete_conversation`
- Add `Mastodon::REST::Client#verify_app_credentials`
- Add `Mastodon::REST::Client#create_account`
- Add `Mastodon::REST::Client#search_accounts`
- Add `Mastodon::REST::Client#pin`
- Add `Mastodon::REST::Client#unpin`
- Add `Mastodon::REST::Client#delete_suggestion`
- Add `Mastodon::REST::Client#list_timeline`
- Add `card` to `Mastodon::Status`
- Add `bot?`, `emojis`, `fields` to `Mastodon::Account`
- Add `visible_in_picker` to `Mastodon::Emoji`
- Add `stats`, `languages`, `contact_account` to `Mastodon::Instance`
- Add `showing_reblogs?`, `endorsed?` to `Mastodon::Relationship`
- Add `Mastodon::Streaming::Client#direct`
- Add support for `conversation` and `filters_changed` events in streams

### Changed

- Change method signature of `Mastodon::REST::Client#create_status`
- Change method signature of `Mastodon::REST::Client#upload_media`
- Change method signature of `Mastodon::REST::Client#update_media`
- Change type of `:avatar` and `:header` params in `Mastodon::REST::Client#update_credentials`
- Rename `Mastodon::Streaming::DeletedStatus` to `Mastodon::Streaming::Events::StatusDelete`
- Change `Mastodon::REST::Client#search` to use the v2 version of the API
- Change `Mastodon::Results#hashtags` to be a collection of `Mastodon::Hashtag`
- Rename `Mastodon::Streaming::Client#firehose` to `Mastodon::Streaming::Client#public`

### Removed

- Remove `Mastodon::REST::Client#follow_by_uri`
92 changes: 47 additions & 45 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,97 +1,99 @@
PATH
remote: .
specs:
mastodon-api (1.2.0)
addressable (~> 2.5)
buftok
http (~> 3.0)
oj (~> 3.3)
mastodon-api (2.0.0)
addressable (~> 2.6)
buftok (~> 0)
http (~> 3.3)
oj (~> 3.7)

GEM
remote: https://rubygems.org/
specs:
addressable (2.5.2)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
ast (2.3.0)
ast (2.4.0)
buftok (0.2.0)
coderay (1.1.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
diff-lcs (1.3)
docile (1.1.5)
domain_name (0.5.20170404)
docile (1.3.1)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
fuubar (2.3.1)
fuubar (2.3.2)
rspec-core (~> 3.0)
ruby-progressbar (~> 1.4)
hashdiff (0.3.7)
http (3.0.0)
hashdiff (0.3.8)
http (3.3.0)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (>= 2.0.0.pre.pre2, < 3)
http-form_data (~> 2.0)
http_parser.rb (~> 0.6.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
http-form_data (2.0.0)
http-form_data (2.1.1)
http_parser.rb (0.6.0)
jaro_winkler (1.5.2)
json (2.1.0)
method_source (0.9.0)
oj (3.3.10)
parallel (1.12.1)
parser (2.4.0.2)
ast (~> 2.3)
powerpack (0.1.1)
pry (0.11.3)
method_source (0.9.2)
oj (3.7.8)
parallel (1.13.0)
parser (2.6.0.0)
ast (~> 2.4.0)
powerpack (0.1.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (3.0.1)
public_suffix (3.0.3)
rainbow (3.0.0)
rake (12.3.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
rake (12.3.2)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.0)
rubocop (0.52.1)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.63.1)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
unicode-display_width (~> 1.4.0)
ruby-progressbar (1.10.0)
safe_yaml (1.0.4)
simplecov (0.15.1)
docile (~> 1.1.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
timecop (0.9.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.4)
unicode-display_width (1.3.0)
webmock (3.2.1)
unf_ext (0.0.7.5)
unicode-display_width (1.4.1)
webmock (3.5.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
yard (0.9.12)
yard (0.9.18)
yardstick (0.9.9)
yard (~> 0.8, >= 0.8.7.2)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.0)
bundler (~> 1.7)
fuubar
mastodon-api!
pry
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ Mastodon API Ruby Gem

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

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

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

Expand Down
21 changes: 21 additions & 0 deletions lib/mastodon/access_token.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module Mastodon
class AccessToken < Mastodon::Base
# @!attribute [r] access_token
# @return [String]
# @!attribute [r] token_type
# @return [String]
# @!attribute [r] scope
# @return [String]
# @!attribute [r] created_at
# @return [String]
normal_attr_reader :access_token,
:token_type,
:scope,
:created_at

def initialize(attributes = {})
attributes.fetch('access_token')
super
end
end
end
15 changes: 14 additions & 1 deletion lib/mastodon/account.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require 'mastodon/emoji'
require 'mastodon/field'

module Mastodon
class Account < Mastodon::Base
# @!attribute [r] id
Expand Down Expand Up @@ -30,8 +33,14 @@ class Account < Mastodon::Base
# @return [String]
# @!attribute [r] locked?
# @return [Boolean]
# @!attribute [r] bot?
# @return [Boolean]
# @!attribute [r] moved
# @return [Mastodon::Account]
# @!attribute [r] emojis
# @return [Mastodon::Collection<Mastodon::Emoji>]
# @!attribute [r] fields
# @return [Mastodon::Collection<Mastodon::Field>]

normal_attr_reader :id,
:username,
Expand All @@ -48,10 +57,14 @@ class Account < Mastodon::Base
:following_count,
:statuses_count

predicate_attr_reader :locked
predicate_attr_reader :locked,
:bot

object_attr_reader :moved, Mastodon::Account

collection_attr_reader :emojis, Mastodon::Emoji
collection_attr_reader :fields, Mastodon::Field

def initialize(attributes = {})
attributes.fetch('id')
super
Expand Down
2 changes: 1 addition & 1 deletion lib/mastodon/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Card < Mastodon::Base
:title,
:description,
:image,
:type
:type,
:author_name,
:author_url,
:provider_name,
Expand Down
25 changes: 25 additions & 0 deletions lib/mastodon/conversation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'mastodon/account'
require 'mastodon/status'

module Mastodon
class Conversation < Mastodon::Base
# @!attribute [r] id
# @return [String]
# @!attribute [r] unread?
# @return [Boolean]
# @!attribute [r] accounts
# @return [Mastodon::Collection<Mastodon::Account>]
# @!attribute [r] last_status
# @return [Mastodon::Status]

normal_attr_reader :id
predicate_attr_reader :unread
collection_attr_reader :accounts, Mastodon::Account
object_attr_reader :last_status, Mastodon::Status

def initialize(attributes = {})
attributes.fetch('id')
super
end
end
end
9 changes: 9 additions & 0 deletions lib/mastodon/emoji.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ class Emoji < Mastodon::Base
# @return [String]
# @!attribute [r] url
# @return [String]
# @!attribute [r] visible_in_picker?
# @return [Boolean]

normal_attr_reader :shortcode, :static_url, :url

predicate_attr_reader :visible_in_picker

def initialize(attributes = {})
attributes.fetch('shortcode')
super
end
end
end
18 changes: 18 additions & 0 deletions lib/mastodon/field.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module Mastodon
class Field < Mastodon::Base
# @!attribute [r] name
# @return [String]
# @!attribute [r] value
# @return [String]
# @!attribute [r] verified_at
# @return [String]

normal_attr_reader :name, :value, :verified_at

# Is this field a verified link?
# @return [Boolean]
def verified?
attributes['verified_at'].present?
end
end
end

0 comments on commit 4e75bec

Please sign in to comment.