Class: Butterfly::Provider::Dribbble

Inherits:
Base
  • Object
show all
Defined in:
lib/butterfly/provider/dribbble.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Butterfly::Provider::Base

Instance Method Details

#likesObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/butterfly/provider/dribbble.rb', line 13

def likes
  @likes ||= raw["shots"].collect do |raw_like|
    Butterfly::Like.new({
      :service => "dribbble",
      :id => raw_like["id"],
      :title => raw_like["title"],
      :description => raw_like["title"],
      :created_at => DateTime.parse(raw_like["created_at"]),
      :liked_at => nil,
      :tags => [],
      :photo_url => raw_like["image_url"],
      :url => raw_like["url"],
      :type => "photo",
      :user => Butterfly::User.new({
        :id => raw_like["player"]["id"],
        :username => raw_like["player"]["username"],
        :name => raw_like["player"]["name"],
        :service_url => raw_like["player"]["url"],
        :photo_url => raw_like["player"]["avatar_url"],
        :website_url => raw_like["player"]["website_url"],
        :location => raw_like["player"]["location"],
      })
    })
  end
end

#rawObject



9
10
11
# File 'lib/butterfly/provider/dribbble.rb', line 9

def raw
  @raw ||= self.class.get("/players/#{username}/shots/likes", :format => :json)
end