0.0
No commit activity in last 3 years
No release in over 3 years
Export a user's links from Bitly.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

 Project Readme

Bitly Exporter

Code Climate Build Status Coverage Status

This gem exports a user's links from the Bitly V3 API. It requires a generic OAuth access token that you can obtain from Bitly. It makes use of the User Link History API.

Installation

Add this line to your applications Gemfile:

gem 'bitly_exporter'

Or install it directly:

gem install bitly_exporter

Usage

First, create a user and an exporter:

user = BitlyExporter::User.new('youroauthaccesstoken')
exporter = BitlyExporter::Exporter.new(user)

The export method triggers the export. There are two ways to consume the results.

Using a block:

exporter.export do |link|
  # Create a record, store the link, etc
end

As a traditional method:

results = exporter.export

results.each_with_index do |link, index|
  puts "Link Index: #{index}, Link: #{link.link}"
end

export takes two optional arguments: progress & max. Set progress to true to see progress while exporting. Setting max will import (in increments of 100) up to the maximum specified. This is a good way to see a sample response.

Show progress:

results = exporter.export(true)

With max:

exporter.export(false, 200) do |link|
  # Create a record, store the link, etc
end

Link Objects

See the API docs for more information. A link object has the following methods:

  • link (short_link)
  • long_url
  • aggregate_link (global_bitly_identifier)
  • archived
  • title
  • private
  • client_id
  • created_at
  • modified_at
  • user_ts

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. Write Tests
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

License

This code is provided under the MIT license. See LICENSE for more details.