I have the following controller- courses-controller.rb:
class CoursesController < ApplicationController
def index
@search_term = params[:looking_for] || 'jhu'
@courses = Coursera.for(@search_term)
end
end
Following model - coursera.rb:
class Coursera
include HTTParty
base_uri 'https://api.coursera.org/api/catalog.v1/courses'
default_params fields: "smallIcon,shortDescription", q: "search"
format :json
def self.for term
get("", query: { query: term})["elements"]
end
end
And following view- index.html.erb:
<h1>Searching for - <%= @search_term %></h1>
<table border="1">
<tr>
<th>Image</th>
<th>Name</th>
<th>Description</th>
</tr>
<% @courses.each do |course| %>
<tr class=<%= cycle('even', 'odd') %>>
<td><%= image_tag(course["smallIcon"])%></td>
<td><%= course["name"] %></td>
<td><%= course["shortDescription"] %></td>
</tr>
<% end %>
</table>
But, when I do http://localhost:3000/courses/index, I get the following error:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
Application Trace | Framework Trace | Full Trace
app/models/coursera.rb:9:in for'
app/controllers/courses_controller.rb:4:in
index'
Please tell me what to do. Nothing works!