module Imgflip
Constants
- IMGLFIP_PASSWORD
- IMGLFIP_USERNAME
- VERSION
Public Class Methods
caption_image(template_id, text0, text1)
click to toggle source
# File lib/imgflip.rb, line 18 def self.caption_image(template_id, text0, text1) response = Net::HTTP.post_form(URI.parse('https://api.imgflip.com/caption_image'), template_id: template_id, text0: text0, text1: text1, username: IMGLFIP_USERNAME, password: IMGLFIP_PASSWORD) response_json = JSON.parse(response.body) raise response_json['error_message'] unless response_json['success'] == true response_json['data']['url'] end
get_memes()
click to toggle source
# File lib/imgflip.rb, line 9 def self.get_memes response = Net::HTTP.get(URI.parse('https://api.imgflip.com/get_memes')) response_json = JSON.parse(response) raise response_json['error_message'] unless response_json['success'] == true response_json['data']['memes'] end