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
- Fork it
- Create your feature branch (git checkout -b feature/my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin feature/my-new-feature)
- Create new Pull Request