0.01
No commit activity in last 3 years
No release in over 3 years
Ruby gem to work with Diaspora*. Note: this is not wrapping an official API, since there is no such thing. The gem just makes HTTPS requests and parses answers, which are friendly for parsing due to usage of JSON.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

diaspora_api

Ruby gem to work with Diaspora*

Note: this is not wrapping an official API, since there is no such thing. The gem just makes HTTPS requests and parses answers, which are friendly for parsing due to usage of JSON. The gem will move on the official API as soon it is available. The official API support is in progress.

Usage

Unofficial API

For the moment, the following actions are available with this gem:

  • Log into Diaspora*
  • Acquire aspect list
  • Post a message
  • There are some more available now, check the source code (PRs with documentation updates are welcome)

To post a message you can do the following:

require "diaspora_api"

c = DiasporaApi::InternalApi.new("https://example-podhost.org")

puts c.login("username", "passowrd")
puts c.post("script test post", "test") # message and aspect

Official API

Authorization (new application)

require "diaspora_api"
api = DiasporaApi::ApiV1.new("https://example-podhost.org")
cl = api.client_register("client_name") # This registers a new application on the pod
cl.identifier # => "0621bc7...." Save this
cl.secret # => "8ba0f9b..." Save this
api.login("username", "passowrd")
api.authorize_application # Invokes OpenID Connect authorization for the application

Authorization (previously registered application)

require "diaspora_api"
api = DiasporaApi::ApiV1.new("https://example-podhost.org")
cl = api.client_set("client_identifier", "client_secret") # Values saved on registration
api.login("username", "passowrd")
api.authorize_application # Invokes OpenID Connect authorization for the application

Query user info

ui = api.user_info
ui.profile # => https://example-podhost.org/people/a73c...