telegraph_api_ruby

A Ruby interface to Telegra.ph API.

Installation

Add following line to your Gemfile:

gem 'telegraph_api_ruby'

And then execute:

$ bundle

Or install it system-wide:

$ gem install telegraph_api_ruby

Usage

require 'telegraph_api_ruby'

telegraph_access_token = 'YOUR_ACCESS_TOKEN'

html = %(
  <b>Hello World</b>
)

content = TelegraphApi::DomToNode.call(html)

data = {
  access_token: telegraph_access_token,
  title: 'Test page',
  content: JSON.dump(content),
  return_content: true
}

result = TelegraphApi::Client.create_page(data)
result.url

See tests also.

Methods

See Available methods and Types.

You are able to call any method described on telegra.ph/api page right forward:

TelegraphApi::Client.getAccountInfo(access_token: 'TOKEN')

Because this gem uses method_missing for unlisted in Available methods list.

Contributing

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