drewolson-diggr 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.1.5 / 2009-06-25
2
+
3
+ * 1 minor feature
4
+
5
+ * Added support for short urls
6
+
1
7
  === 0.1.3 / 2008-09-09
2
8
 
3
9
  * 1 minor bug-fix
@@ -9,6 +9,8 @@ module Diggr
9
9
  :galleryphoto,
10
10
  :media,
11
11
  :medium,
12
+ :shorturl,
13
+ :shorturls,
12
14
  :stories,
13
15
  :story,
14
16
  :topic,
@@ -23,6 +25,7 @@ module Diggr
23
25
  "comments",
24
26
  "photos",
25
27
  "media",
28
+ "shorturls",
26
29
  "stories",
27
30
  "topics",
28
31
  "users"
@@ -16,7 +16,7 @@ module Diggr
16
16
  container.short_name = data['short_name']
17
17
 
18
18
  if data.has_key? 'topics'
19
- data['topics'].each do |topic_data|
19
+ data['topics'].each do | topic_data |
20
20
  container.topics << Topic.new_from_parsed_json(topic_data)
21
21
  end
22
22
  end
@@ -4,11 +4,12 @@ need { 'user' }
4
4
  need { 'topic' }
5
5
  need { 'container' }
6
6
  need { 'photo' }
7
+ need { 'short_url' }
7
8
 
8
9
  module Diggr
9
10
  class Story
10
11
  attr_accessor :id, :link, :submit_date, :diggs, :comments, :title, :description,
11
- :status, :media, :user, :topic, :container, :thumbnail, :href
12
+ :status, :media, :user, :topic, :container, :thumbnail, :href, :shorturl
12
13
 
13
14
  def self.new_from_parsed_json(data)
14
15
  story = Story.new
@@ -21,6 +22,7 @@ module Diggr
21
22
  story.topic = Diggr::Topic.new_from_parsed_json(data['topic']) if data['topic']
22
23
  story.container = Diggr::Container.new_from_parsed_json(data['container']) if data['container']
23
24
  story.thumbnail = Diggr::Photo.new_from_parsed_json(data['thumbnail']) if data['thumbnail']
25
+ story.shorturl = Diggr::ShortUrl.new_from_parsed_json(data['shorturl'][0]) if data['shorturl']
24
26
 
25
27
  story
26
28
  end
data/test/test_story.rb CHANGED
@@ -43,13 +43,17 @@ class TestStory < Test::Unit::TestCase
43
43
  "width" => 80,
44
44
  "height" => 80
45
45
  },
46
+ "shorturl" => [{
47
+ "short_url" => "http://digg.com/D123JKL",
48
+ "views" => 1
49
+ }],
46
50
  "href" => "http://digg.com/linux_unix/Jukebox_con_Linux"
47
51
  }
48
52
 
49
53
  photo = Diggr::Story.new_from_parsed_json(parsed_json_data)
50
54
 
51
55
  parsed_json_data.each do |key,val|
52
- unless val.kind_of? Hash
56
+ unless val.kind_of? Hash or val.kind_of? Array
53
57
  assert_equal val, photo.send(key)
54
58
  end
55
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drewolson-diggr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drew Olson