Giter VIP home page Giter VIP logo

ruby-matrix-sdk's Introduction

Ruby Matrix SDK

A Ruby gem for easing the development of software that communicates with servers implementing the Matrix protocol.

There is a Matrix room for the discussion about usage and development at #ruby-matrix-sdk:kittenface.studio.

Live YARD documentation can be found at; http://aleol57.gitlab-pages.liu.se/ruby-matrix-sdk

Example usage

# Raw API usage
require 'matrix_sdk'

api = MatrixSdk::Api.new 'https://matrix.org'

api.login user: 'example', password: 'notarealpass'
api.whoami?
# => {:user_id=>"@example:matrix.org"}

# It's possible to call arbitrary APIs as well
api.request :get, :federation_v1, '/version'
# => {:server=>{:version=>"0.28.1", :name=>"Synapse"}}
# Client wrapper
require 'matrix_sdk'

client = MatrixSdk::Client.new 'https://example.com'
client.login 'username', 'notarealpass' #, no_sync: true

client.rooms.count
# => 5
hq = client.find_room '#matrix:matrix.org'
# => #<MatrixSdk::Room:00005592a1161528 @id="!cURbafjkfsMDVwdRDQ:matrix.org" @name="Matrix HQ" @topic="The Official Matrix HQ - please come chat here! | To support Matrix.org development: https://patreon.com/matrixdotorg | Try http://riot.im/app for a glossy web client | Looking for homeserver hosting? Check out https://upcloud.com/matrix!" @canonical_alias="#matrix:matrix.org" @aliases=["#matrix:jda.mn"] @join_rule=:public @guest_access=:can_join @event_history_limit=10>
hq.guest_access?
# => true
hq.send_text "This is an example message - don't actually do this ;)"
# => {:event_id=>"$123457890abcdef:matrix.org"}
# Client wrapper
require 'matrix_sdk'

client = MatrixSdk::Client.new 'https://example.com'
client.api.access_token = 'thisisnotarealtoken'

# Doesn't automatically trigger a sync when setting the token directly
client.rooms.count
# => 0

client.sync
client.rooms.count
# => 5

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ananace/ruby-matrix-sdk

License

The gem is available as open source under the terms of the MIT License.

ruby-matrix-sdk's People

Contributors

ananace avatar ilvez avatar

Watchers

James Cloos avatar Aaron Raimist avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.