user2122528
user2122528

Reputation: 71

Consuming a rest API in rails 3.2.13

I have two rails apps running on different ports. From one app I am trying to consume the API of the other app. Here's the code for Product.rb model in APP_1.

class Product < ActiveResource::Base
  self.site = "https://localhost:3000"
  self.ssl_options = {:cert         => OpenSSL::X509::Certificate.new(File.open(pem_file)),
                      :key          => OpenSSL::PKey::RSA.new(File.open(pem_file)),
                      :ca_path      => "/path/to/OpenSSL/formatted/CA_Certs",
                      :verify_mode  => OpenSSL::SSL::VERIFY_PEER}
end

I have a controller and routes set for Product model. When I run APP_1 i get

 undefined local variable or method `pem_file' for Product:Class

Can anyone tell me about how to write a pem file, what is a pem file?

Upvotes: 0

Views: 170

Answers (1)

BenjiBoyWick
BenjiBoyWick

Reputation: 387

Check out: https://serverfault.com/questions/9708/what-is-a-pem-file-and-how-does-it-differ-from-other-openssl-generated-key-file

This should give you enough to start Googling and sourcing your solution.

Upvotes: 1

Related Questions