Method: MarketingAPI#get_optin

Defined in:
lib/marketing_api.rb

#get_optin(id) ⇒ Object

Gets an optin Params:

+id

ID of the optin in the DB

Returns optin as JSON if it is found, nil otherwise



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/marketing_api.rb', line 27

def get_optin(id)
  if !uri_valid?
    return nil
  end
  uri = URI.parse("http://#{@server}:#{@port}/#{id }")
  response = Net::HTTP.get_response(uri)
  if response.code == "200"
    return response.body
  else
    return nil
  end
end