Class: JohnStamos::Client
- Inherits:
-
Object
- Object
- JohnStamos::Client
- Defined in:
- lib/john_stamos/client.rb
Instance Attribute Summary collapse
-
#proxy ⇒ Object
Returns the value of attribute proxy.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #json_content(url, params) ⇒ Object
- #page_content(url) ⇒ Object
- #pin(pinterest_pin_id) ⇒ Object
- #pinner(username) ⇒ Object
- #search_pins(search_text, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
4 5 6 7 8 |
# File 'lib/john_stamos/client.rb', line 4 def initialize(={}) = { proxy: nil } = .merge() @proxy = [:proxy] end |
Instance Attribute Details
#proxy ⇒ Object
Returns the value of attribute proxy.
2 3 4 |
# File 'lib/john_stamos/client.rb', line 2 def proxy @proxy end |
Instance Method Details
#json_content(url, params) ⇒ Object
31 32 33 34 35 |
# File 'lib/john_stamos/client.rb', line 31 def json_content(url, params) response = make_json_request(url, params) JSON.parse(response) end |
#page_content(url) ⇒ Object
25 26 27 28 29 |
# File 'lib/john_stamos/client.rb', line 25 def page_content(url) response = make_request(url) Nokogiri::HTML(response) end |
#pin(pinterest_pin_id) ⇒ Object
17 18 19 |
# File 'lib/john_stamos/client.rb', line 17 def pin(pinterest_pin_id) JohnStamos::Pin.new(self, pinterest_pin_id) end |
#pinner(username) ⇒ Object
21 22 23 |
# File 'lib/john_stamos/client.rb', line 21 def pinner(username) JohnStamos::Pinner.new(self, username) end |
#search_pins(search_text, options = {}) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/john_stamos/client.rb', line 10 def search_pins(search_text, ={}) search_scraper = JohnStamos::PinSearch.new(self, search_text, ) search_scraper.execute! search_scraper.pins end |