callsign 2.1.0 → 2.2.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.
- data/lib/callsign.rb +7 -0
- metadata +15 -4
data/lib/callsign.rb
CHANGED
@@ -6,12 +6,15 @@ require 'rubygems'
|
|
6
6
|
require 'uri'
|
7
7
|
require 'net/http'
|
8
8
|
require 'json'
|
9
|
+
require 'hashie'
|
9
10
|
|
10
11
|
class InvalidCallsignException < StandardError; end
|
11
12
|
class InvalidHTTPResponseException < StandardError; end
|
12
13
|
class CallookUpdateException < StandardError; end
|
13
14
|
|
14
15
|
class Callsign
|
16
|
+
attr_accessor :json
|
17
|
+
|
15
18
|
def initialize(callsign)
|
16
19
|
json_uri = URI.parse "http://callook.info/#{callsign}/json"
|
17
20
|
json_response = Net::HTTP.new(json_uri.host, json_uri.port).get(json_uri.path)
|
@@ -27,6 +30,10 @@ class Callsign
|
|
27
30
|
raise CallookUpdateException, 'Callook.info offline for daily update'
|
28
31
|
end
|
29
32
|
end
|
33
|
+
|
34
|
+
def self.search(callsign)
|
35
|
+
Hashie::Mash.new(Callsign.new(callsign).json)
|
36
|
+
end
|
30
37
|
|
31
38
|
# This literally passes to the JSON response that we get.
|
32
39
|
# This means that if the server returns a string for a key, you will get that.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: callsign
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: &
|
16
|
+
requirement: &22994260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,18 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *22994260
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hashie
|
27
|
+
requirement: &22993820 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *22993820
|
25
36
|
description: Provides a simple Ruby interface to the callook.info API by Joshua Dick,
|
26
37
|
W1JDD.
|
27
38
|
email: ricky@elrod.me
|