Module: Wonderfl::Utils
- Included in:
- Code
- Defined in:
- lib/wonderfl/utils.rb
Defined Under Namespace
Classes: Cache
Instance Method Summary collapse
-
#dump(path, api_key) ⇒ Object
Dumps object as a JSON string (for debugging).
-
#parse_time(date) ⇒ Object
Creates a new Time object with the date from epoch.
Instance Method Details
#dump(path, api_key) ⇒ Object
Dumps object as a JSON string (for debugging).
4 5 6 7 |
# File 'lib/wonderfl/utils.rb', line 4 def dump(path, api_key) url = Wonderfl::BASE_URL + path + '?api_key=' + api_key Net::HTTP.get_response(URI.parse(url)).body end |
#parse_time(date) ⇒ Object
Creates a new Time object with the date from epoch.
10 11 12 |
# File 'lib/wonderfl/utils.rb', line 10 def parse_time(date) date ? Time.at(date) : nil end |