Class: Curl::Easy
- Inherits:
-
Object
- Object
- Curl::Easy
- Defined in:
- lib/curbemu.rb
Instance Attribute Summary collapse
-
#body_str ⇒ Object
Returns the value of attribute body_str.
-
#conn ⇒ Object
Returns the value of attribute conn.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
- .http_get(url) {|c| ... } ⇒ Object
-
.http_post(url, options = {}) {|c| ... } ⇒ Object
Curl::Easy.http_post(“foo.com”, => url) { |r| r.headers = ‘Content-Type: text/json’ }.body_str).
-
.perform(url) {|c| ... } ⇒ Object
Curl::Easy.perform(“old-xisbn.oclc.org/xid/isbn/1234”).body_str Curl::Easy.perform(“old-xisbn.oclc.org/xid/isbn/1234”).header_str.
Instance Method Summary collapse
-
#header_str ⇒ Object
Not yet implemented..
- #http_post(options = {}) ⇒ Object
-
#initialize(url = nil) ⇒ Easy
constructor
A new instance of Easy.
- #perform ⇒ Object
Constructor Details
#initialize(url = nil) ⇒ Easy
Returns a new instance of Easy.
14 15 16 17 18 |
# File 'lib/curbemu.rb', line 14 def initialize(url = nil) @url = url @headers = {} @body_str = nil end |
Instance Attribute Details
#body_str ⇒ Object
Returns the value of attribute body_str.
12 13 14 |
# File 'lib/curbemu.rb', line 12 def body_str @body_str end |
#conn ⇒ Object
Returns the value of attribute conn.
12 13 14 |
# File 'lib/curbemu.rb', line 12 def conn @conn end |
#headers ⇒ Object
Returns the value of attribute headers.
12 13 14 |
# File 'lib/curbemu.rb', line 12 def headers @headers end |
#timeout ⇒ Object
Returns the value of attribute timeout.
12 13 14 |
# File 'lib/curbemu.rb', line 12 def timeout @timeout end |
#url ⇒ Object
Returns the value of attribute url.
12 13 14 |
# File 'lib/curbemu.rb', line 12 def url @url end |
Class Method Details
.http_get(url) {|c| ... } ⇒ Object
34 35 36 37 38 39 |
# File 'lib/curbemu.rb', line 34 def self.http_get(url) c = self.new(url) yield(c) if block_given? c.perform c end |
.http_post(url, options = {}) {|c| ... } ⇒ Object
Curl::Easy.http_post(“foo.com”, => url) { |r| r.headers = ‘Content-Type: text/json’ }.body_str)
42 43 44 45 46 47 |
# File 'lib/curbemu.rb', line 42 def self.http_post(url, = {}) c = self.new(url) yield(c) if block_given? c.http_post() c end |
.perform(url) {|c| ... } ⇒ Object
Curl::Easy.perform(“old-xisbn.oclc.org/xid/isbn/1234”).body_str Curl::Easy.perform(“old-xisbn.oclc.org/xid/isbn/1234”).header_str
27 28 29 30 31 32 |
# File 'lib/curbemu.rb', line 27 def self.perform(url) c = self.new(url) yield(c) if block_given? c.perform c end |
Instance Method Details
#header_str ⇒ Object
Not yet implemented.. only needed for importing from LibraryThing
21 22 23 |
# File 'lib/curbemu.rb', line 21 def header_str "" end |