Method: MarketingAPI#update_optin

Defined in:
lib/marketing_api.rb

#update_optin(json_string) ⇒ Object

Updates an optin from JSON Returns true if it is updated, nil if optin is not found or update failed Params:

+json_string

JSON to turn into an optin



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/marketing_api.rb', line 62

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