contact-data 0.3.0 → 0.3.1

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: f59ba9c14cee2938fbf80b40f4a93da17dbd80ee
4
- data.tar.gz: e113709bf3721ba919e808dd098e47043f06c51e
3
+ metadata.gz: 9fdbd300463e8faf65caf800a26911027f49528c
4
+ data.tar.gz: 4fa928a323b4ad62aa5c94873090864751fa08a2
5
5
  SHA512:
6
- metadata.gz: f502119985d44d6f3e2dc2ea578b9a028921d1da6db5421a5cca71d042cb2aa160c6b2a5875e541d90ec4f21611f4435cc73c69c08f5ce20b9478c4d3af11188
7
- data.tar.gz: 119ff74bf7c08f43e976476600909463a744293ea86a671b2b3aa29cd0cf64cbccd8eee7bd166db66a6ec7c50b07ecce03c8ed2889addd3f2700a9d9da26ec81
6
+ metadata.gz: 779e92818d0f127cba4b65d1df5aa0697717d777420a3fb4012cbbe880f0f27ce495fabe8bcfcd24f416dc4ed59996c0d7d8af52ef5608c43f1a413a6519edc8
7
+ data.tar.gz: 980648841034f69ca805a787c5fab051bcaba30ba47a12c564318e5496980bebf1706f4d14fcece58303abcc4c768441c779339cd702b6322479c68b525f3e9b
data/lib/contact-data.rb CHANGED
@@ -1,11 +1,30 @@
1
1
  # encoding: utf-8
2
- require 'addressable/uri'
3
- require 'json'
4
- require 'logger'
5
- require 'hash'
6
- require 'contact-data/options'
7
2
  require 'contact-data/contact'
8
3
  require 'contact-data/link'
9
4
  require 'contact-data/text'
10
5
  require 'contact-data/fetcher'
11
6
  require 'contact-data/deprecated'
7
+
8
+ class Hash
9
+ def to_options(base, text = nil)
10
+ o = { base: base }
11
+
12
+ [:verbose, :url_base, :api_base, :format, :noformat].each { |k| o[k] = delete(k) if key?(k) }
13
+
14
+ o[:payload] = { text: text } if text
15
+ o[:params] = self unless empty?
16
+ o
17
+ end
18
+ end
19
+
20
+ require 'addressable/uri'
21
+
22
+ class String
23
+ def encode_component
24
+ Addressable::URI.encode_component(self, Addressable::URI::CharacterClasses::PATH)
25
+ end
26
+
27
+ def to_options(base)
28
+ { url: self }.to_options(base)
29
+ end
30
+ end
@@ -1,6 +1,4 @@
1
1
  # encoding: utf-8
2
- require 'string'
3
-
4
2
  module ContactData
5
3
  class Deprecated
6
4
  class << self
@@ -1,5 +1,4 @@
1
1
  # encoding: utf-8
2
-
3
2
  module ContactData
4
3
  class Exception < RuntimeError
5
4
  end
@@ -1,4 +1,6 @@
1
1
  # encoding: utf-8
2
+ require 'logger'
3
+ require 'json'
2
4
  require 'rest-client'
3
5
  require 'contact-data/exception'
4
6
 
@@ -14,6 +14,7 @@ module ContactData
14
14
  end
15
15
 
16
16
  def search(params = {})
17
+ params[:timeout] ||= 600
17
18
  Fetcher.get :search, params.to_options(BASE)
18
19
  end
19
20
  end
@@ -5,6 +5,7 @@ module ContactData
5
5
  BASE = :text
6
6
 
7
7
  def self.search(text = nil, params = {})
8
+ params[:timeout] ||= 600
8
9
  Fetcher.post :search, params.to_options(BASE, text)
9
10
  end
10
11
  end
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module ContactData
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contact-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xenapto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-15 00:00:00.000000000 Z
11
+ date: 2015-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -202,11 +202,8 @@ files:
202
202
  - lib/contact-data/exception.rb
203
203
  - lib/contact-data/fetcher.rb
204
204
  - lib/contact-data/link.rb
205
- - lib/contact-data/options.rb
206
205
  - lib/contact-data/text.rb
207
206
  - lib/contact-data/version.rb
208
- - lib/hash.rb
209
- - lib/string.rb
210
207
  - spec/contact-data_contact_spec.rb
211
208
  - spec/contact-data_deprecated_spec.rb
212
209
  - spec/contact-data_link_spec.rb
@@ -1,2 +0,0 @@
1
- module ContactData
2
- end
data/lib/hash.rb DELETED
@@ -1,11 +0,0 @@
1
- class Hash
2
- def to_options(base, text = nil)
3
- o = { base: base }
4
-
5
- [:verbose, :url_base, :api_base, :format, :noformat].each { |k| o[k] = delete(k) if key?(k) }
6
-
7
- o[:payload] = { text: text } if text
8
- o[:params] = self unless empty?
9
- o
10
- end
11
- end
data/lib/string.rb DELETED
@@ -1,9 +0,0 @@
1
- class String
2
- def encode_component
3
- Addressable::URI.encode_component(self, Addressable::URI::CharacterClasses::PATH)
4
- end
5
-
6
- def to_options(base)
7
- { url: self }.to_options(base)
8
- end
9
- end