relinkly
Installation
Add this line to your application's Gemfile:
gem 'relinkly'
And then execute:
$ bundle
Or install it yourself as:
$ gem install relinkly
Usage
If using Rails, put the following into your application.rb. If just Ruby,
run this before trying to use the API.
Relinkly.configure do |config|
config.api_key = 'YOUR_KEY_HERE'
end
Instantiate an API object.
api = Relinkly::API.new
API Requests
Account and Workspaces
api.domains
api.domain(id)
api.domain_count(options)
api.account
api.workspaces
Tags
api.tags
api.tag(id)
api.tag_count(options)
api.new_tag(options)
api.update_tag(id, options)
api.delete_tag(id, options)
Links
api.links
api.links(id)
api.link_count(options)
api.new_link(options)
api.shorten(destination, options)
api.update_link(id, options)
api.delete_link(id, options)
api.tags_link(id, options)
Make a new branded short link
my_domain = api.domains.first
link = api.shorten('https://google.com', domain: my_domain.to_h, title: 'Google', description: 'Google Homepage')
Workspace workaround
Please see the applicable methods for options available when making requests. In case of new link creation, default workspace is selected if workspace isn't mentioned explictly.
Please pass the workspace_id in the options as follows in case you want to create branded link to another workspace.
my_domain = api.domains.first
my_workspace_id = api.workspaces.first.id
link = api.shorten('https://google.com', domain: my_domain.to_h, title: 'Google', description: 'Google Homepage', workspace: my_workspace_id)
Please note that my_domain
should already be included inside my_workspace
. You can find all the details about your workspace by going here. https://app.rebrandly.com/workspaces
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/cdrrazan/relinkly.
License
The gem is available as open source under the terms of the MIT License.