lib/createsend/segment.rb in createsend-3.4.0 vs lib/createsend/segment.rb in createsend-4.0.0

- old
+ new

@@ -7,33 +7,32 @@ @segment_id = segment_id super end # Creates a new segment. - def self.create(auth, list_id, title, rules) + def self.create(auth, list_id, title, rule_groups) options = { :body => { :Title => title, - :Rules => rules }.to_json } + :RuleGroups => rule_groups }.to_json } cs = CreateSend.new auth response = cs.post "/segments/#{list_id}.json", options response.parsed_response end # Updates this segment. - def update(title, rules) + def update(title, rule_groups) options = { :body => { :Title => title, - :Rules => rules }.to_json } - response = cs_put "/segments/#{segment_id}.json", options + :RuleGroups => rule_groups }.to_json } + cs_put "/segments/#{segment_id}.json", options end # Adds a rule to this segment. - def add_rule(subject, clauses) + def add_rule_group(rule_group) options = { :body => { - :Subject => subject, - :Clauses => clauses }.to_json } - response = post "rules", options + :Rules => rule_group }.to_json } + post "rules", options end # Gets the active subscribers in this segment. def subscribers(date="", page=1, page_size=1000, order_field="email", order_direction="asc") @@ -53,15 +52,15 @@ Hashie::Mash.new(response) end # Clears all rules of this segment. def clear_rules - response = cs_delete "/segments/#{segment_id}/rules.json", {} + cs_delete "/segments/#{segment_id}/rules.json", {} end # Deletes this segment. def delete - response = super "/segments/#{segment_id}.json", {} + super "/segments/#{segment_id}.json", {} end private def get(action, options = {}) \ No newline at end of file