Getting Farday::SSLError
while fetching posts from instagram.
I have refred this tutorial
Below is the code snippet
Gemfile
gem 'instagram'
config\\initializers\\instagram.rb
require "sinatra"
require "instagram"
Instagram.configure do |config|
config.client_id = "4ad05f8aa5a24827b6c5e3c825ff2528"
config.access_token = "06a7eb3dd2ec45d6a576e3b3576fc423"
end
homecontroller
def index
@galleries = Gallery.all
@banners = Slideshow.where(gallery_id: nil)
@instagram = Instagram.user_recent_media("592393738", {:count => 1})
end
index.html.erb
<% @instagram.each do |instagram| %>
<%= image_tag instagram.images.standard_resolution.url %>
<% end %>
In the view, replace instagram.images.standard_resolution.url
with instagram.images.standard_resolution.url.sub(/^https?\\:/, '')
Alternatively, you can try this gem https://github.com/agilie/instagram_api_gem
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.