Class: JohnStamos::Pin

Inherits:
Object
  • Object
show all
Defined in:
lib/john_stamos/pin.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, pinterest_pin_id) ⇒ Pin

Returns a new instance of Pin.



4
5
6
7
# File 'lib/john_stamos/pin.rb', line 4

def initialize(client, pinterest_pin_id)
  @id = pinterest_pin_id
  @client = client
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/john_stamos/pin.rb', line 2

def id
  @id
end

Instance Method Details

#boardObject

TODO: Make this a Board object… not just a url



22
23
24
# File 'lib/john_stamos/pin.rb', line 22

def board
  embedded_pin_data["board"]["url"]
end

#descriptionObject



17
18
19
# File 'lib/john_stamos/pin.rb', line 17

def description
  embedded_pin_data("description")
end

#imageObject



9
10
11
# File 'lib/john_stamos/pin.rb', line 9

def image
  embedded_pin_data["images"]["orig"]["url"]
end

#like_countObject



26
27
28
# File 'lib/john_stamos/pin.rb', line 26

def like_count
  embedded_pin_data("like_count")
end

#pinnerObject



38
39
40
# File 'lib/john_stamos/pin.rb', line 38

def pinner
  JohnStamos::Pinner.new(@client, embedded_pin_data["pinner"]["username"])
end

#repin_countObject



30
31
32
# File 'lib/john_stamos/pin.rb', line 30

def repin_count
  embedded_pin_data("repin_count")
end

#source_urlObject



34
35
36
# File 'lib/john_stamos/pin.rb', line 34

def source_url
  embedded_pin_data("link")
end

#urlObject



42
43
44
# File 'lib/john_stamos/pin.rb', line 42

def url
  "http://pinterest.com/pin/#{@id}/"
end

#video?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/john_stamos/pin.rb', line 13

def video?
  embedded_pin_data("is_video")
end