I am new to using youtube-g gem and i would like to embed a youtube video rapper that plays videos on my rails app hosted from youtube. pls does anyone know a youtube-g tutorial or another gem with a simpler readme and documentation that can help. So also a quick tutorial help as an answer would be great
The 'youtube-g' gem was actually replaced by the 'youtube_it' gem located here: https://github.com/kylejginavan/youtube_it
If all you want to do is a regular embed of a youtube video, you can just use this wrapper (HAML syntax):
%iframe{:title => "YouTube video player", :class => "youtube-player", :type => "text/html", :width => "425", :height => "349",:src => #your_model_name.video_link, :frameborder => "0", :allowFullScreen => true, :id => 'my_video_player' }
If you want to dynamically pull videos from your youTube channel you need to create a client and pull the stream like so:
client = YouTubeIt::Client.new( :username => 'your_user_name', :password => 'you_password', :dev_key => 'your_api_key')
results = client.videos_by(:user => 'your_user_display_name')
That will give you a VideoSearch Object. If you wanted to iterate through all of those video objects:
results.videos
That will return an array of Video objects where you have access to all of these attributes listed here: http://rubydoc.info/gems/youtube_it/1.4.1/YouTubeIt/Model/Video
This includes the YouTube url. If you wanted to use the player and and url on your page, you can just do some regEx to extract the video_id and build it yourself. Hope this helps.
Related
I am trying to pull in the first video from an unlisted YouTube playlist. I found the simple_parser gem but since it hasn't been updated in a few years, I decided to go with feedjira instead. I'm not sure if this is my lack of knowledge and feedjira's lack of advice for noobs or if feedjira has a bug.
Anyhow, I'm getting this error: uninitialized constant Youtube::Feedjira
Here's my code:
def open_rss
playlist_url = "https://www.youtube.com/feeds/videos.xml?playlist_id=" + playlist_id
feed = Feedjira::Feed.fetch_and_parse playlist_url
video = feed.entries.first
details = {:title => video.title,
:description => video.content,
:url => video.media_url,
:thumbnail => video.media_thumbnail_url
}
return details
end
I don't know if I missed a setup step or what since I couldn't find much info on setting this thing up. Thanks for the help!
I'm using the Koala gem to post images to the Facebook wall with the put_object method. The problem I'm having is that the images show up as thumbnails on the wall (with a caption) instead of the larger image that I'm expecting. When you click on the thumbnail, I'm expecting the photo to pop open in Facebook's photo viewer, but it simply directs me to the URL of the image I specified. This seems more like the behavior I'd expect when posting a link to the wall. I've also tried using post_picture with no success. Here is a screenshot of what I'm expecting: http://cl.ly/image/472a2H333z13
My stream permissions include the following:
read_stream,offline_access,manage_pages,publish_stream,create_event,rsvp_event,sms,user_photos,friends_about_me,friends_status,friends_activities,friends_likes,friends_interests,read_insights,friends_photos
The following code works but not as expected - here is a screenshot of how an image posted in using put_object appears on the timeline: http://cl.ly/image/1x3X1K0k2l2D
put_object('me', 'feed', :message => 'this is the message', :name => 'this is the caption', :picture => 'http://www.socialvolt.com/img/producttour/listen.png', :source => 'http://www.socialvolt.com/img/producttour/ssPublish.jpg')
This code doesn't work at all:
put_picture('me', 'feed', :message => 'this is the message', :name => 'this is the caption', :picture => 'http://www.socialvolt.com/img/producttour/listen.png', :source => 'http://www.socialvolt.com/img/producttour/ssPublish.jpg')
I also can't find any difference between :picture and :source.
Can anyone help me figure out what I'm doing wrong?
Here is the code.
graph = Koala::Facebook::API.new(cookies[:acess_token])
begin
graph.put_picture(
"https://dl.dropboxusercontent.com/u/71317935/banners/coy_copper.jpg",
"image/png",
{:message => "introduces Some information"}
)
rescue Exception => e
render :text => e.message and return
end
Off the top of my head, you may need a larger photo. More specifically, I think the width needs to be at least 480px.
The images in your code seem to be less than 480px:
http://www.socialvolt.com/img/producttour/listen.png
http://www.socialvolt.com/img/producttour/ssPublish.jpg
This comes from experience with User Generated Photos. You're not really using Open Graph Actions, so I have no idea if Facebook applies the same rules for this to generic photo uploads.
Hi I have read all the other post relating to this but I think I am missing something fundamental. I am using mini_fb in my ruby on rails application for handling the facebook api. I have the following code:
current_user.session.post('me', :type => :feed, :params => {:name => "name",
:to => "{\"data\":[{\"name\":\"#{friend.facebook_name}\",\"id\":\"#{friend.facebook_id}\"}]}",
:link => url_of_app,
:description => "desc",
:actions => "{\"name\": \"action name\", \"link\": \"url\"}"})
The above posts to the current user's wall with or without the "to" parameter set. Everything works, except for the "to" parameter. I have read the graph post to wall over and over again and I can't figure out what is wrong with this code of mine. I would really appreciate it if someone could point out my mistake.
I've never used ruby's version, but probably the problem is in the first parameter. You are targeting 'me' feed, while should be targeting your friends feed. Try fetching your friend id and doing something like
current_user.session.post(friend.facebook_id, :type => :feed, :params => ...)
Wow, mini_fb looks so verbose :)
Telémako is right, you need to use your friends id. I give you another alternative for more nice code. Use Koala.
https://github.com/arsduo/koala/wiki/Graph-API
#graph.put_wall_post("explodingdog!", {:name => "i love loving you", :link => "http://www.explodingdog.com/title/ilovelovingyou.html"}, "tmiley")
=> {"id"=>"83901496_520908898070"}
I use it in my projects and works very well.
I am using docmail's Simple API for sending Postcard.They have implemented this functionality recently, but I didn't get any sample code or instruction for implementation.
Thanks in advance,
Gaurav Soni
I got my answer.Here is a sample code that can interact with Docmail Simple API methods.
require "base64"
require "soap/wsdlDriver"
class TestDocmailLetterSending
def initialize(account)
api="https://www.cfhdocmail.com/Test_SimpleAPI/DocMail.SimpleAPI.asmx?wsdl"
#test = SOAP::WSDLDriverFactory.new(api).create_rpc_driver
contents = open(file, "rb") do |f|
f.read
end
result = #test.sendLetterToSingleAddress(
'sUsr' => "username",
'sPwd' => "password",
'sMailingName' => "string",
'sCallingApplicationID' => "string",
'bColour' => true,
'bDuplex' => true or false,
'eDeliveryType' => "StandardClass",
'sTemplateFileName' => File.basename(file),
'eAddressNameFormat' => "FullName",
'bTemplateData' => contents,
'sFirstName' => first_name,
'sLastName' => last_name,
'sAddress1' => "",
'sAddress2' => ,
'sAddress3' => ,
'sAddress4' => ,
'sPostCode' => ,
'bProofApprovalRequired' => 'false'
)
end
end
We don't have any RoR examples at this time - others here may be able to help, but it's essentially a SOAP webservice, with the SimpleAPI using less complex data types than the standard version. The standard API already lets you send postcards and letters, but is more complex to use from some environments due to it's complex data types.
The test version of Docmail's SimpleAPI has now been updated to expose postcard calls to allow physical postcards to be send via the Simple version of the API. Once we're happy with the updates, we'll make them available in the live version too.
Although you've probably already been through the other info on the API, here are some links/addresses in case anyone else needs them:
Docmail API Info Page
Simple API Test Webservice & Website (for the Simple API Live versions, replace "Test" with "Live"):
https://www.cfhdocmail.com/Test_SimpleAPI/DocMail.SimpleAPI.asmx?WSDL
https://www.cfhdocmail.com/Test
Hope that helps.
Will
(from Docmail)
I have a ruby-on-rails application that wishes to utilise the tumblr gem for adding posts when an action is taken (eg: creating a blog post)
I currently have the tumblr gem installed and can manage to fetch my posts using
#tumblruser = Tumblr::User.new('myemail','mypassword')
However when i go to add a post where it asks me to pass the user information like so (according to the API for the gem)
post = Tumblr::Post.create(#tumblruser, :type => 'video', :embed => #post.video_html, :title => #post.title, :caption => #post.content)
it just does not want to authenticate and returns a 403 error
anyone had any experience with this?
NEW SOLUTION:
I have found recently that there has been a problem with the gem. So I have made a copy of it, changed a few things in the docs and code and put it at http://rubygems.org/gems/matenia-tumblr-api
Hope the changes and docs help someone else out there.
As always I welcome any improvements, or refactoring on any of my projects.
Kind Regards,
Matenia
OLD ANSWER BELOW
I managed to get around this by the way ... all i did was declare the username and password in place of #tumblruser like so:
post = Tumblr::Post.create(:email => 'user name email here',
:password => 'my password',
:type => 'video',
:embed => #post.video_html,
:caption => #postcontent)
where #postcontent is the html text of post.content and gsubbed to escape most of the html.
hope this saves someone else some time.
If you are only going to check authentication with any media like Facebook , Twitter ,LinkedIn ,Tumblr , Github and almost 20 others (you can check Here ) .Then omniauth gem is the first thing that comes to mind . Means It's clearly simplest solution for authentication and I love it