link_shortener 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 942ca94a2d18deffddc543cc247e83d549b79fb0
4
- data.tar.gz: ef9a1fda4e6987eac7a7fb6387b4a2fc44453961
3
+ metadata.gz: 3d9e998d6d7262f7ca9c05b89242d19d97e32b16
4
+ data.tar.gz: 7627358b675fea49bc150d83cc9d944d92e570aa
5
5
  SHA512:
6
- metadata.gz: 5c33852b0dd8c47f19fbf799d89b50d89d12c1c5cbfe65b5b00509120354aeefeda1e6c5da9cff1d8803e098358a556428bd8f557953942fe75f695db14fa711
7
- data.tar.gz: 483d637f54fe0d56d3d57d122c89236d90c814cc7e86f0ebc4822f8bb34a6cfe61fe8d7fef65af69adce6a5535f1835be574ff5633cfd8c2dd44afe3cd98f946
6
+ metadata.gz: 8564c370f73c2458cf9d9d0e7dfed8074cad13c45b3c7e601993ed41cf9782fdd561a999bcf876d1c1d1c1d4066f54caa8d3e6bbb3cc9ebe72fe3622f5ba89c3
7
+ data.tar.gz: 1975cf48b3e04178230ec203ee238147648b58de6a6f47e92f83da24ac53579cd7e6b4869e99d2b1bb06ddf730cc05f95920d072f71f17c780e353afdcccf9bb
data/README.md CHANGED
@@ -1,34 +1,12 @@
1
1
  # LinkShortener
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/link_shortener`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'link_shortener'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install link_shortener
22
-
23
3
  ## Usage
24
4
 
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
5
+ ```
6
+ LinkShortener::Main.new('http://google.com').call
7
+ ```
30
8
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
9
+ set ENV['DEBUG_LINKS'] for debug
32
10
 
33
11
  ## Contributing
34
12
 
@@ -17,10 +17,8 @@ module LinkShortener
17
17
  url = parse_field(response, 'shortUrl')
18
18
  return nil if url.blank?
19
19
  "#{protocol}://#{url}"
20
- rescue RestClient::ExceptionWithResponse => e
21
- process_api_error(e)
22
- rescue => e
23
- Rollbar.warning(e)
20
+ rescue StandardError => e
21
+ raise(e) if ENV['DEBUG_LINKS'].present?
24
22
  nil
25
23
  end
26
24
 
@@ -48,19 +46,5 @@ module LinkShortener
48
46
  def protocol_for(response)
49
47
  parse_field(response, 'https') ? 'https' : 'http'
50
48
  end
51
-
52
- def process_api_error(e)
53
- key = "link_error_raised_#{e.message[0..10]}"
54
-
55
- return if redis.get(key) # prevent reaching rollbar limits
56
- redis.set(key, true)
57
- redis.expire(key, 2.hours.to_i)
58
- Rollbar.warning(e)
59
- nil
60
- end
61
-
62
- def redis
63
- Redis.current
64
- end
65
49
  end
66
50
  end
@@ -1,3 +1,3 @@
1
1
  module LinkShortener
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: link_shortener
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Korolev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-27 00:00:00.000000000 Z
11
+ date: 2018-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport