Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This script assumes you have instantiated a ZendeskAPI::Client and assigned it to 'client'
- ticket = client.tickets.find(:id => 4060)
- comments = ticket.comments.fetch
- # Iterate over comments and show comment value and value for the 'public' attribute (using example json public comments are 'bar' and private are 'foo')
- comments.each do |c|
- puts "the comment value is #{c.body}"
- puts "the comments 'public' attribute is #{c.public}"
- end;nil
- # Iterate over comments with select() which takes a comparison and filters out any items where the comparison does not match
- # var_filtered = array.select {|iteratee| iteratee.predicate == filter_criteria}
- public_comments = comments.select {|c| c.public == true}
- # Should only output comments with 'bar' in value (and description)
- public_comments.each do |c|
- puts c.body
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement