Method: MarketingAPI#create_optin
- Defined in:
- lib/marketing_api.rb
#create_optin(json_string) ⇒ Object
Creates an optin from JSON Returns true if it is created, nil otherwise Params:
- +json_string
-
JSON to turn into an optin
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/marketing_api.rb', line 44 def create_optin(json_string) if !uri_valid? return nil end req = Net::HTTP::Post.new("/create", 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 |