jsonip 1.0.5 → 1.0.7

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: 68fab1a0d40b66e903c899a8b88df3f032275fde
4
- data.tar.gz: 2e1e78b0f33af2bb0c2c3e9a769721a4920b0f82
3
+ metadata.gz: 78b5eb52de869f1ed2d689ece949335f08569c71
4
+ data.tar.gz: c9c33ce4c1dc9fbccdb9c7d1c7ecc2ce8d173f51
5
5
  SHA512:
6
- metadata.gz: ee1eae6e67e1d03e554c30757e6e46f8d9939949e39b2733ab8efefd3e2e9a91d7f1d3dc08ec198f53775054b95ccc2ecc443d0448183cb808bc82067f08f580
7
- data.tar.gz: 54fbbd1c31c38f4234e67ab0331072c8f372e8c2536de2fb78122629d4ec5e9610250a0ecec1db422df3af3bb57acf454c5dd7e24a16e20c66a136c7b97c763f
6
+ metadata.gz: e754591d8233ee972d632b7ed56e1784889256828936f69fd619f868ef6fb2d875cfbe08cc7c7fbaa6a3de7be8b616abf546d95583c9723258303b9730e9936a
7
+ data.tar.gz: 58a0ee57ba41a43b5959358bfd5a01e1f5781abde5b62c66b4f1312b1c9b36787096b53cf8e719ba342526d8fcfeb264540a2169fdc7261a6940ca2ff62b4eb4
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'jsonip'
4
+
5
+ # arguments hack to have a default task.
6
+ #
7
+ # thor's <tt>default_task</tt> is causing problem when i use this cli app as
8
+ # subcommand from another app.
9
+ ARGV << "copy" if ARGV.empty?
10
+
11
+ Jsonip::CLI.start(ARGV)
data/bin/myip CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  require 'jsonip'
4
4
 
5
+ # arguments hack to have a default task.
6
+ #
7
+ # thor's <tt>default_task</tt> is causing problem when i use this cli app as
8
+ # subcommand from another app.
5
9
  ARGV << "copy" if ARGV.empty?
6
10
 
7
11
  Jsonip::CLI.start(ARGV)
@@ -24,6 +24,10 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency "clipboard"
25
25
  spec.add_dependency "hashie"
26
26
 
27
+ if RUBY_VERSION =~ /1.8/
28
+ spec.add_dependency "json"
29
+ end
30
+
27
31
  spec.add_development_dependency "bundler", "~> 1.3"
28
32
  spec.add_development_dependency "rake"
29
33
  spec.add_development_dependency "rspec"
@@ -1,22 +1,13 @@
1
- require 'faraday'
2
- require 'faraday_middleware'
3
-
4
- require "jsonip/version"
5
-
6
1
  module Jsonip
7
- autoload :CLI, 'jsonip/cli'
2
+ autoload :CLI, 'jsonip/cli'
3
+ autoload :Client, 'jsonip/client'
4
+ autoload :VERSION, 'jsonip/version'
8
5
 
9
6
  def self.get
10
- response = connection.get('/')
11
- response.body.ip
7
+ jsonip.get
12
8
  end
13
9
 
14
- def self.connection
15
- @connection ||= Faraday.new 'http://jsonip.org' do |builder|
16
- builder.response :mashify
17
- builder.response :json
18
- builder.adapter Faraday.default_adapter
19
- end
10
+ def self.jsonip
11
+ Client.new
20
12
  end
21
13
  end
22
-
@@ -0,0 +1,21 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+
4
+ module Jsonip
5
+ class Client
6
+
7
+ def get
8
+ connection.get('/').body.ip
9
+ end
10
+
11
+ private
12
+
13
+ def connection
14
+ @connection ||= Faraday.new 'http://jsonip.org' do |builder|
15
+ builder.response :mashify
16
+ builder.response :json
17
+ builder.adapter Faraday.default_adapter
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module Jsonip
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Calás Lozano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-10 00:00:00.000000000 Z
11
+ date: 2013-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -126,6 +126,7 @@ description: Copy your IP to clipboard
126
126
  email:
127
127
  - calas@qvitta.net
128
128
  executables:
129
+ - jsonip
129
130
  - myip
130
131
  extensions: []
131
132
  extra_rdoc_files: []
@@ -137,10 +138,12 @@ files:
137
138
  - LICENSE.txt
138
139
  - README.md
139
140
  - Rakefile
141
+ - bin/jsonip
140
142
  - bin/myip
141
143
  - jsonip.gemspec
142
144
  - lib/jsonip.rb
143
145
  - lib/jsonip/cli.rb
146
+ - lib/jsonip/client.rb
144
147
  - lib/jsonip/version.rb
145
148
  - spec/jsonip_spec.rb
146
149
  - spec/spec_helper.rb