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.
6 7 8 9 10 |
# File 'lib/john_stamos/client.rb', line 6 def initialize(={}) = { proxy: nil } = .merge() @proxy = [:proxy] end |
Instance Attribute Details
#proxy ⇒ Object
Returns the value of attribute proxy.
4 5 6 |
# File 'lib/john_stamos/client.rb', line 4 def proxy @proxy end |
Instance Method Details
#json_content(url, params) ⇒ Object
33 34 35 36 37 |
# File 'lib/john_stamos/client.rb', line 33 def json_content(url, params) response = make_json_request(url, params) JSON.parse(response) end |
#page_content(url) ⇒ Object
27 28 29 30 31 |
# File 'lib/john_stamos/client.rb', line 27 def page_content(url) response = make_request(url) Nokogiri::HTML(response) end |
#pin(pinterest_pin_id) ⇒ Object
19 20 21 |
# File 'lib/john_stamos/client.rb', line 19 def pin(pinterest_pin_id) JohnStamos::Pin.new(self, pinterest_pin_id) end |
#pinner(username) ⇒ Object
23 24 25 |
# File 'lib/john_stamos/client.rb', line 23 def pinner(username) JohnStamos::Pinner.new(self, username) end |
#search_pins(search_text, options = {}) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/john_stamos/client.rb', line 12 def search_pins(search_text, ={}) search_scraper = JohnStamos::PinSearch.new(self, search_text, ) search_scraper.execute! search_scraper.pins end |