callsign 2.0.0 → 2.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.
Files changed (2) hide show
  1. data/lib/callsign.rb +5 -3
  2. metadata +29 -51
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # (c) 2011-present. Ricky Elrod <ricky@elrod.me>
3
+ # (c) 2012-present. Ricky Elrod <ricky@elrod.me>
4
4
  # Released under the MIT license.
5
5
  require 'rubygems'
6
6
  require 'uri'
@@ -8,13 +8,15 @@ require 'net/http'
8
8
  require 'json'
9
9
 
10
10
  class InvalidCallsignException < StandardError; end
11
+ class InvalidHTTPResponseException < StandardError; end
11
12
  class CallookUpdateException < StandardError; end
12
13
 
13
14
  class Callsign
14
15
  def initialize(callsign)
15
16
  json_uri = URI.parse "http://callook.info/#{callsign}/json"
16
- json_response = Net::HTTP.new(json_uri.host, json_uri.port).get(json_uri.path).body
17
- @json = JSON.parse json_response
17
+ json_response = Net::HTTP.new(json_uri.host, json_uri.port).get(json_uri.path)
18
+ raise InvalidHTTPResponseException if json_response.code.to_i > 200
19
+ @json = JSON.parse json_response.body
18
20
 
19
21
  # Handle invalid/update before the user can do anything that
20
22
  # would error anyway.
metadata CHANGED
@@ -1,79 +1,57 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: callsign
3
- version: !ruby/object:Gem::Version
4
- hash: 15
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.0
5
5
  prerelease:
6
- segments:
7
- - 2
8
- - 0
9
- - 0
10
- version: 2.0.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ricky Elrod
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-12-14 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: json
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &11988840 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- description: Provides a simple Ruby interface to the callook.info API by Joshua Dick, W1JDD.
23
+ prerelease: false
24
+ version_requirements: *11988840
25
+ description: Provides a simple Ruby interface to the callook.info API by Joshua Dick,
26
+ W1JDD.
35
27
  email: ricky@elrod.me
36
28
  executables: []
37
-
38
29
  extensions: []
39
-
40
30
  extra_rdoc_files: []
41
-
42
- files:
31
+ files:
43
32
  - lib/callsign.rb
44
33
  homepage: http://github.com/codeblock/callsign-gem
45
34
  licenses: []
46
-
47
35
  post_install_message:
48
36
  rdoc_options: []
49
-
50
- require_paths:
37
+ require_paths:
51
38
  - lib
52
- required_ruby_version: !ruby/object:Gem::Requirement
39
+ required_ruby_version: !ruby/object:Gem::Requirement
53
40
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
61
- required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
46
  none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- hash: 3
67
- segments:
68
- - 0
69
- version: "0"
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
70
51
  requirements: []
71
-
72
52
  rubyforge_project: CallSignRb
73
- rubygems_version: 1.8.5
53
+ rubygems_version: 1.8.17
74
54
  signing_key:
75
55
  specification_version: 3
76
56
  summary: Look up United States Amateur (ham) Radio callsign information.
77
57
  test_files: []
78
-
79
- has_rdoc: