Class: Capture
- Inherits:
-
Object
- Object
- Capture
- Defined in:
- lib/capture.rb
Constant Summary collapse
- API_URL =
"https://cdn.capture.page"- EDGE_URL =
"https://edge.capture.page"
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#sessions ⇒ Object
readonly
Returns the value of attribute sessions.
Instance Method Summary collapse
- #build_animated_url(url, options = {}) ⇒ Object
- #build_content_url(url, options = {}) ⇒ Object
- #build_image_url(url, options = {}) ⇒ Object
- #build_metadata_url(url, options = {}) ⇒ Object
- #build_pdf_url(url, options = {}) ⇒ Object
- #fetch_animated(url, options = {}) ⇒ Object
- #fetch_content(url, options = {}) ⇒ Object
- #fetch_image(url, options = {}) ⇒ Object
- #fetch_metadata(url, options = {}) ⇒ Object
- #fetch_pdf(url, options = {}) ⇒ Object
-
#initialize(key, secret, options = {}) ⇒ Capture
constructor
A new instance of Capture.
Constructor Details
#initialize(key, secret, options = {}) ⇒ Capture
Returns a new instance of Capture.
53 54 55 56 57 58 59 60 |
# File 'lib/capture.rb', line 53 def initialize(key, secret, = {}) @key = key @secret = secret = .nil? ? {} : raise TypeError, "options must be a Hash" unless .is_a?(Hash) @options = @sessions = CaptureSessions.new(self) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
51 52 53 |
# File 'lib/capture.rb', line 51 def key @key end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
51 52 53 |
# File 'lib/capture.rb', line 51 def @options end |
#sessions ⇒ Object (readonly)
Returns the value of attribute sessions.
51 52 53 |
# File 'lib/capture.rb', line 51 def sessions @sessions end |
Instance Method Details
#build_animated_url(url, options = {}) ⇒ Object
78 79 80 |
# File 'lib/capture.rb', line 78 def build_animated_url(url, = {}) build_url(url, "animated", ) end |
#build_content_url(url, options = {}) ⇒ Object
70 71 72 |
# File 'lib/capture.rb', line 70 def build_content_url(url, = {}) build_url(url, "content", ) end |
#build_image_url(url, options = {}) ⇒ Object
62 63 64 |
# File 'lib/capture.rb', line 62 def build_image_url(url, = {}) build_url(url, "image", ) end |
#build_metadata_url(url, options = {}) ⇒ Object
74 75 76 |
# File 'lib/capture.rb', line 74 def (url, = {}) build_url(url, "metadata", ) end |
#build_pdf_url(url, options = {}) ⇒ Object
66 67 68 |
# File 'lib/capture.rb', line 66 def build_pdf_url(url, = {}) build_url(url, "pdf", ) end |
#fetch_animated(url, options = {}) ⇒ Object
98 99 100 |
# File 'lib/capture.rb', line 98 def fetch_animated(url, = {}) fetch_binary(build_animated_url(url, )) end |
#fetch_content(url, options = {}) ⇒ Object
90 91 92 |
# File 'lib/capture.rb', line 90 def fetch_content(url, = {}) fetch_json(build_content_url(url, )) end |
#fetch_image(url, options = {}) ⇒ Object
82 83 84 |
# File 'lib/capture.rb', line 82 def fetch_image(url, = {}) fetch_binary(build_image_url(url, )) end |
#fetch_metadata(url, options = {}) ⇒ Object
94 95 96 |
# File 'lib/capture.rb', line 94 def (url, = {}) fetch_json((url, )) end |
#fetch_pdf(url, options = {}) ⇒ Object
86 87 88 |
# File 'lib/capture.rb', line 86 def fetch_pdf(url, = {}) fetch_binary(build_pdf_url(url, )) end |