sunlightpartytime 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/sunlightpartytime.rb +23 -4
  2. metadata +2 -2
@@ -6,10 +6,9 @@ class SunlightPartyTime
6
6
  @apikey = apikey
7
7
  end
8
8
 
9
- # Make clean event
10
- # Integrate with TT
11
- # Test with tables
12
- # Test with timelinegen
9
+ # Update gem
10
+ # Push to git
11
+ # Add to TT
13
12
 
14
13
  # Get legislator ID
15
14
  def crp_id(name)
@@ -32,4 +31,24 @@ class SunlightPartyTime
32
31
  data = HTTParty.get("http://politicalpartytime.org/api/v1/event/?beneficiaries__crp_id=" + cid.to_s + "&format=json", options)["objects"]
33
32
  return data.to_json
34
33
  end
34
+
35
+ # Get a cleaner JSON of party events
36
+ def parties_clean(cid)
37
+ parties = JSON.parse(parties(cid))
38
+ partyarray = Array.new
39
+
40
+ parties.each do |p|
41
+ savehash = Hash.new
42
+ phash = Hash[*p.flatten]
43
+
44
+ savehash["start time"] = phash["start_date"].to_s
45
+ savehash["end time"] = phash["end_date"].to_s
46
+ savehash["headline"] = "Party: " + phash["entertainment"].to_s
47
+ savehash["text"] = "contributions_info: " + phash["contributions_info"].to_s + " venue: " + phash["venue"]["venue_name"].to_s + " " + phash["venue"]["city"].to_s + ", " + phash["venue"]["state"].to_s
48
+
49
+ partyarray.push(savehash)
50
+ end
51
+
52
+ partyarray.to_json
53
+ end
35
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunlightpartytime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-12-17 00:00:00.000000000 Z
12
+ date: 2013-12-20 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Access to Sunlight Foundation's Party Time data.
15
15
  email: shidash@shidash.com