parvus 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 076c50b850af8cc1a8888354c5532bf1976970e8
4
- data.tar.gz: 7ddcbd0d23c11b25f5b541b39f9ae715852d2a46
3
+ metadata.gz: d8c6d1b2f7163a584443c94f11234a1327b8a0e4
4
+ data.tar.gz: a1c46b3f0fe5c8b6dc1167326da2e4955cb81e4c
5
5
  SHA512:
6
- metadata.gz: b981ca7099b02749cf67702bd2fa458ea261f9e8972870104af96a8aac28c3239e607176ae6a2dbdffc93ada51f28b6e3002727ba261312f542bb76174ca22bc
7
- data.tar.gz: 44194105fa98c948b7d3dd72bc23f21a984842664fe1afb8515f418bd4079d5dec23206c4c042b20dcf40853ac8fcba9c637abc1a180269b0843a6faf712b079
6
+ metadata.gz: eaafad90b65554ece2ae667d3fa0857bc9625c238d5205fe8b23c92f9449afc109e6899705cb9a3223269cd55a22a288e442fda32e20729fe5f83d1f42c00a42
7
+ data.tar.gz: e89573a0385265c44d0b5ef0e91765db8d9e09506eae6eb93175978faf979ad9a5483126026f55c282ed370b97a30c8b984afc2ca374aa17bf7105b66833a707
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Yet another URL shortening gem
4
4
 
5
+ ## Currently supported shortening services:
6
+
7
+ * [butts.so](http://butts.so) *For fart noise short links!*
8
+ * [bitly](https://bitly.com)
9
+ * *More coming soon!*
10
+
5
11
  ## Installation
6
12
 
7
13
  $ gem install parvus
@@ -1,4 +1,5 @@
1
1
  require_relative 'shorteners/butts_so'
2
+ require_relative 'shorteners/bitly'
2
3
 
3
4
  class CommandLineParser < Thor
4
5
  map '--version' => :version, '-v' => :version
@@ -6,9 +7,10 @@ class CommandLineParser < Thor
6
7
  desc 'shorten URL',
7
8
  'shortens the given URL using a service (butts.so by default)'
8
9
  method_option :service, type: :string, default: 'butts.so', aliases: '-s',
9
- enum: %w(butts.so)
10
+ enum: %w(butts.so bitly)
10
11
  def shorten(url)
11
12
  puts ButtsSo.get_short_url(url) if options[:service].eql? 'butts.so'
13
+ puts Bitly.get_short_url(url) if options[:service].eql? 'bitly'
12
14
  end
13
15
 
14
16
  desc 'version', 'prints out the version of parvus installed'
@@ -0,0 +1,15 @@
1
+ class Bitly
2
+ @base_uri = 'https://api-ssl.bitly.com'
3
+
4
+ def self.get_short_url(url)
5
+ options = { query:
6
+ {
7
+ access_token: '15a79b3bc8f0e040c1d1ffbe87d18f056f7403bb',
8
+ longUrl: url,
9
+ format: 'txt'
10
+ }
11
+ }
12
+
13
+ HTTParty.get("#{@base_uri}/v3/shorten", options).strip
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Parvus
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parvus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Mathewson
@@ -105,6 +105,7 @@ files:
105
105
  - bin/parvus
106
106
  - lib/parvus.rb
107
107
  - lib/parvus/cli.rb
108
+ - lib/parvus/shorteners/bitly.rb
108
109
  - lib/parvus/shorteners/butts_so.rb
109
110
  - lib/parvus/version.rb
110
111
  - parvus.gemspec
metadata.gz.sig CHANGED
Binary file