Skip to content

Instantly share code, notes, and snippets.

@nag-cheedella
Last active May 20, 2017 21:33
Show Gist options
  • Save nag-cheedella/eb947efe4358941d823172a555001267 to your computer and use it in GitHub Desktop.
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
#!/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&#39;ve heard that saying before, &quot;You need 8-10 glasses of water a day.&quot; 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