Last active
May 20, 2017 21:33
-
-
Save nag-cheedella/eb947efe4358941d823172a555001267 to your computer and use it in GitHub Desktop.
Decode html elements in Ruby. Example written on how to use ooyala ruby sdk to interact with apis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
#simple snippet to decode html elements in ruby | |
# Uses Ooyala Ruby SDK. Read the usage of SDK first at https://github.com/ooyala/ruby-v2-sdk | |
require './ooyala_api' | |
require 'htmlentities' | |
apikey = "<<api-key>>" | |
secret = "<<secret>>" | |
api = Ooyala::API.new(apikey, secret) | |
input = "We've heard that saying before, "You need 8-10 glasses of water a day." But is that really true? How can we tell when we need to drink water?" | |
output = HTMLEntities.new.decode(input) | |
body = Hash.new | |
body[:description] = output | |
response = api.patch("assets/<<embed_code>>",body) | |
puts response | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment