Class: PintrestApi::Pin
- Extended by:
- Authentication
- Defined in:
- lib/pintrest_api/pin.rb
Overview
Pintrest Pin model
Constant Summary collapse
- PIN_BASE_CSS =
'.Grid .Module.Pin.PinBase'- PIN_IMAGE_CSS =
'.pinHolder .pinImg'- PIN_TITLE_CSS =
'.richPinGridTitle'- PIN_CREDIT_CSS =
'.creditItem a'- PIN_URL_CSS =
'.pinImageActionButtonWrapper .pinNavLink'- PIN_DESCRIPT_CSS =
'.pinDescription'
Constants included from Authentication
Authentication::EMAIL_INPUT_CSS, Authentication::LOGIN_PAGE_BUTTON_CSS, Authentication::PASSWORD_INPUT_CSS, Authentication::PINTREST_LOGIN_URL
Constants inherited from Core
Class Attribute Summary collapse
-
.is_logged_in ⇒ Object
Returns the value of attribute is_logged_in.
Instance Attribute Summary collapse
-
#credits_url ⇒ Object
readonly
Returns the value of attribute credits_url.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#image_url ⇒ Object
readonly
Returns the value of attribute image_url.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes included from Authentication
Attributes inherited from Core
Class Method Summary collapse
- .get_for_board(board, authentication) ⇒ Object
-
.get_for_board_url(board_url, authentication) ⇒ Object
Gets all pins from a board url.
Instance Method Summary collapse
-
#initialize(image_url, title, credits_url, url, description) ⇒ Pin
constructor
A new instance of Pin.
Methods included from Authentication
Methods inherited from Core
click, get_with_ajax_scroll, html, new_session, scroll_page, visit, visit_page
Constructor Details
#initialize(image_url, title, credits_url, url, description) ⇒ Pin
Returns a new instance of Pin.
14 15 16 17 18 19 20 |
# File 'lib/pintrest_api/pin.rb', line 14 def initialize(image_url, title, credits_url, url, description) @image_url = image_url @title = title @credits_url = credits_url @url = url @description = description end |
Class Attribute Details
.is_logged_in ⇒ Object
Returns the value of attribute is_logged_in.
24 25 26 |
# File 'lib/pintrest_api/pin.rb', line 24 def is_logged_in @is_logged_in end |
Instance Attribute Details
#credits_url ⇒ Object (readonly)
Returns the value of attribute credits_url.
5 6 7 |
# File 'lib/pintrest_api/pin.rb', line 5 def credits_url @credits_url end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/pintrest_api/pin.rb', line 5 def description @description end |
#image_url ⇒ Object (readonly)
Returns the value of attribute image_url.
5 6 7 |
# File 'lib/pintrest_api/pin.rb', line 5 def image_url @image_url end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/pintrest_api/pin.rb', line 5 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/pintrest_api/pin.rb', line 5 def url @url end |
Class Method Details
.get_for_board(board, authentication) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/pintrest_api/pin.rb', line 44 def get_for_board(board, authentication) login(authentication) if !@is_logged_in || authentication @is_logged_in = true @session.visit http_url(board.url) parse_pins get_with_ajax_scroll(PIN_BASE_CSS) end |
.get_for_board_url(board_url, authentication) ⇒ Object
Gets all pins from a board url
Attributes
-
board_url- Pintrest board url -
authentication-
Examples
PintrestApi::Pin.get_for_board_url(‘pintrest.com/mikaak/my-pins’)
35 36 37 38 39 40 41 42 |
# File 'lib/pintrest_api/pin.rb', line 35 def get_for_board_url(board_url, authentication) login(authentication) if !@is_logged_in || authentication @is_logged_in = true @session.visit http_url(board_url) sleep 2 parse_pins get_with_ajax_scroll(PIN_BASE_CSS) end |