0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby interface to Telegra.ph API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.14.0
 Project Readme

telegraph-ruby

A Ruby interface to Telegra.ph API.

Gem Version Say Thanks!

Installation

Add following line to your Gemfile:

gem 'telegraph-ruby'

And then execute:

$ bundle

Or install it system-wide:

$ gem install telegraph-ruby

Usage

require 'telegraph-ruby'

telegraph = Telegraph.new

Methods

telegraph.createAccount(short_name:"cos404")
#=>  {"short_name"=>"cos404", "author_name"=>"", "author_url"=>"", "access_token"=>"e585e79dd4c296228d2a42da1d7c8d0ed18d697d54be5918a4c3a8de88f1","auth_url"=>"https://edit.telegra.ph/auth/Sr5fCg0GUH8Zlx7AzKJAEljgsXcyyBSo2WBCaCh5hp"}
telegraph.editAccountInfo(access_token:'e585e79dd4c296228d2a42da1d7c8d0ed18d697d54be5918a4c3a8de88f1', short_name:'cosmos404')
#=>  {"short_name"=>"cosmos404", "author_name"=>"", "author_url"=>""}
telegraph.getAccountInfo(access_token:'e585e79dd4c296228d2a42da1d7c8d0ed18d697d54be5918a4c3a8de88f1')
#=>  {"short_name"=>"cosmos404", "author_name"=>"", "author_url"=>""}
telegraph.revokeAccessToken(access_token:'e585e79dd4c296228d2a42da1d7c8d0ed18d697d54be5918a4c3a8de88f1')
#=>  {"access_token"=>"4061ba937126ca4928ce1fd468d96953df288d205acbc6a8105a14f32747", "auth_url"=>"https://edit.telegra.ph/auth/6kKW5aur5ebJm8s61mWGEwuolWgRbxlfP69UeElhQv"}
telegraph.createPage(access_token:'4061ba937126ca4928ce1fd468d96953df288d205acbc6a8105a14f32747', title:'telegraph-ruby', content:'[{"tag":"figure","children":[{"tag":"img","attrs":{"src":"http://telegra.ph/file/6a5b15e7eb4d7329ca7af.jpg"}},{"tag":"figcaption","children":[""]}]},{"tag":"p", "children":["A Ruby interface to [Telegra.ph API]"]}]')
#=>  {"path"=>"telegraph-ruby-09-28", "url"=>"http://telegra.ph/telegraph-ruby-09-28", "title"=>"telegraph-ruby", "description"=>"", "views"=>0, "can_edit"=>true}
telegraph.editPage(access_token:'4061ba937126ca4928ce1fd468d96953df288d205acbc6a8105a14f32747', path:'telegraph-ruby-09-28', author_name:'@cosmos404', author_url:'https://t.me/cosmos404', title:'telegraph-ruby', content:'[{"tag":"figure","children":[{"tag":"img","attrs":{"src":"http://telegra.ph/file/6a5b15e7eb4d7329ca7af.jpg"}},{"tag":"figcaption","children":[""]}]},{"tag":"p", "children":["A Ruby interface to [Telegra.ph API]"]}]')
#=>  {"path"=>"telegraph-ruby-09-28", "url"=>"http://telegra.ph/telegraph-ruby-09-28", "title"=>"telegraph-ruby", "description"=>"", "author_name"=>"@cosmos404", "author_url"=>"https://t.me/cosmos404", "views"=>0, "can_edit"=>true}
telegraph.getPage(path:'telegraph-ruby-09-28')
#=>  {"path"=>"telegraph-ruby-09-28", "url"=>"http://telegra.ph/telegraph-ruby-09-28", "title"=>"telegraph-ruby", "description"=>"A Ruby interface to [Telegra.ph API]", "author_name"=>"@cosmos404", "author_url"=>"https://t.me/cosmos404", "image_url"=>"http://telegra.ph/file/6a5b15e7eb4d7329ca7af.jpg", "views"=>2}
telegraph.getPageList(access_token:'4061ba937126ca4928ce1fd468d96953df288d205acbc6a8105a14f32747')
#=>  {"total_count"=>1, "pages"=>[{"path"=>"telegraph-ruby-09-28", "url"=>"http://telegra.ph/telegraph-ruby-09-28", "title"=>"telegraph-ruby", "description"=>"A Ruby interface to [Telegra.ph API]", "author_name"=>"@cosmos404", "author_url"=>"https://t.me/cosmos404", "image_url"=>"http://telegra.ph/file/6a5b15e7eb4d7329ca7af.jpg", "views"=>2, "can_edit"=>true}]}
telegraph.getViews(path:'telegraph-ruby-09-28')
#=>  {"views"=>2}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request