diff --git a/lib/vk/vk_informer_link.rb b/lib/vk/vk_informer_link.rb index a9c4449..251c058 100644 --- a/lib/vk/vk_informer_link.rb +++ b/lib/vk/vk_informer_link.rb @@ -13,7 +13,7 @@ def initialize(domain, node) title = (node[:link][:title] || '').empty? ? node[:link][:url] : node[:link][:title] @text = "[#{title}](#{node[:link][:url]})" - @preview = get_image(node) if node[:link].key? :photo + @preview = get_album_image(node[:link][:photo]) if node[:link].key? :photo end def to_hash @@ -38,10 +38,6 @@ def preview? @preview end - def get_image(node) - node[:link][:photo] - end - def to_hash_text { text: text, diff --git a/spec/fixtures/vk_informer_attachment/link/hash.w_prev.json b/spec/fixtures/vk_informer_attachment/link/hash.w_prev.json index a2ef1dd..b6bd390 100644 --- a/spec/fixtures/vk_informer_attachment/link/hash.w_prev.json +++ b/spec/fixtures/vk_informer_attachment/link/hash.w_prev.json @@ -5,6 +5,14 @@ "title": "sometext", "description": "link description", "target": "internal", - "photo": "http://example.com/image.jpg" + "photo": { + "id": 23456, + "album_id": 12456, + "owner_id": 123, + "sizes": [ + { "height": 75, "url": "http://example.com/image.small.jpg" }, + { "height": 604, "url": "http://example.com/image.jpg" } + ] + } } } \ No newline at end of file diff --git a/spec/fixtures/vk_informer_attachment/link/hash.w_prev.small.json b/spec/fixtures/vk_informer_attachment/link/hash.w_prev.small.json index bc63a9d..935a17d 100644 --- a/spec/fixtures/vk_informer_attachment/link/hash.w_prev.small.json +++ b/spec/fixtures/vk_informer_attachment/link/hash.w_prev.small.json @@ -5,6 +5,13 @@ "title": "sometext", "description": "link description", "target": "internal", - "photo": "http://example.com/image.small.jpg" + "photo": { + "id": 23456, + "album_id": 12456, + "owner_id": 123, + "sizes": [ + { "height": 75, "url": "http://example.com/image.small.jpg" } + ] + } } } \ No newline at end of file