Module: PastebinWrapper
- Defined in:
- lib/vermic/pastebin.rb
Overview
This module works with pastebin.com API.
Constant Summary collapse
- POST_URL =
"http://pastebin.com/api/api_post.php"
- API_DEV_KEY =
"7fe7c0c1814042eb9f0288d93d954fe9"
- API_OPTION =
'paste'
- PASTE_NAME =
'Vermicelli code'
- PASTE_FORMAT =
'c'
- PASTE_PRIVATE =
0
- PASTE_EXPIRE_DATE =
'1H'
Class Method Summary collapse
-
.paste_code(code, params = {}) ⇒ Object
Pastes plain code to the pastebin.com with the given parameters.
-
.paste_file(params = {}) ⇒ Object
Pastes file to the pastebin.com site with the given parameters.
Class Method Details
.paste_code(code, params = {}) ⇒ Object
Pastes plain code to the pastebin.com with the given parameters
19 20 21 22 23 |
# File 'lib/vermic/pastebin.rb', line 19 def self.paste_code(code, params = {}) initialize_parameters(code) @@params.merge(params) paste end |
.paste_file(params = {}) ⇒ Object
Pastes file to the pastebin.com site with the given parameters
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vermic/pastebin.rb', line 28 def self.paste_file(params = {}) code = "" filename = params[:file_name] File.foreach(filename) do |line| code += line end initialize_parameters(code) @@params.merge!(params) paste end |