Method: MarketingAPI#deactivate_optin

Defined in:
lib/marketing_api.rb

#deactivate_optin(id) ⇒ Object

Deactivates an optin Params:

+id

ID of the optin in the DB

Returns true if optin is deactivated, nil if optin is not found or deactivation failed



80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/marketing_api.rb', line 80

def deactivate_optin(id)
  if !uri_valid?
    return nil
  end
  req = Net::HTTP::Post.new("/deactivate/#{id}", initheader = {'Content-Type' =>'application/json'})
  response = Net::HTTP.new(@server, @port).start {|http| http.request(req) }
  if response.code == "200"
    return true
  else
    return nil
  end
end