presdocs 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,7 +4,7 @@ The White House releases a lot of stuff, and some of it is included in what's kn
4
4
 
5
5
  Nearly every day, the White House releases one or more official publications, which may include presidential statements, announcements of nominations, press releases and schedule information. These are published by the Government Printing Office. Presdocs wraps JSON endpoints exposed by GPO, which has created a [mobile application](http://m.gpo.gov/dcpd) for browsing and searching these documents. I owe a debt of gratitude to the government employees who made these endpoints available; your commitment to making public information more easily accessible is truly a public service.
6
6
 
7
- The current version is 0.5.
7
+ The current version is 0.6.
8
8
 
9
9
  ## Installation
10
10
 
@@ -1,7 +1,7 @@
1
1
  module Presdocs
2
2
  class Document
3
3
 
4
- attr_reader :location, :title, :source, :president, :date, :package_id, :lat, :lng, :subjects, :category, :notes, :fdsys_url, :html, :city, :state
4
+ attr_reader :id, :location, :title, :source, :president, :date, :package_id, :lat, :lng, :subjects, :category, :notes, :fdsys_url, :html, :city, :state
5
5
 
6
6
  def initialize(params={})
7
7
  params.each_pair do |k,v|
@@ -14,6 +14,10 @@ module Presdocs
14
14
  instance_variable_set("@#{k}", v)
15
15
  end
16
16
  end
17
+
18
+ def detail
19
+ Document.detail(id)
20
+ end
17
21
 
18
22
  def self.detail(package_id)
19
23
  url = "http://m.gpo.gov/wscpd/mobilecpd/detailwgc/#{package_id}.json"
@@ -97,7 +101,7 @@ module Presdocs
97
101
  detail = result
98
102
  result = result['searchResult']
99
103
  end
100
- city, state = result['location'].split(', ')
104
+ city, state = result['location'].split(', ') if result['location']
101
105
  if coordinates
102
106
  locations = coordinates.map{|l| {"state" => l['state'], "city" => l['city'], "lat" => l["lat"], "lng" => l["lang"]}}.uniq
103
107
  lat = locations.detect{|l| l['city'] == city && l['state'] == state}['lat']
@@ -120,4 +124,4 @@ module Presdocs
120
124
  doc
121
125
  end
122
126
  end
123
- end
127
+ end
@@ -1,3 +1,3 @@
1
1
  module Presdocs
2
- VERSION = "0.5"
2
+ VERSION = "0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: presdocs
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.6'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-27 00:00:00.000000000 Z
12
+ date: 2013-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -122,9 +122,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
122
  - - ! '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- segments:
126
- - 0
127
- hash: -1267846798555734002
128
125
  required_rubygems_version: !ruby/object:Gem::Requirement
129
126
  none: false
130
127
  requirements: