{"id":6934,"date":"2013-09-03T03:51:28","date_gmt":"2013-09-03T03:51:28","guid":{"rendered":"http:\/\/zerokidz.com\/ideas\/?p=6934"},"modified":"2014-06-25T13:57:17","modified_gmt":"2014-06-25T17:57:17","slug":"tweet-from-max-with-ruby","status":"publish","type":"post","link":"https:\/\/reactivemusic.net\/?p=6934","title":{"rendered":"Tweet from Max with ruby"},"content":{"rendered":"<p><span style=\"line-height: 1.6;\">Update 6\/2014: working version here:\u00a0<\/span><a style=\"line-height: 1.6;\" href=\"https:\/\/reactivemusic.net\/?p=7013\">https:\/\/reactivemusic.net\/?p=7013<\/a><\/p>\n<h5>notes<\/h5>\n<p>The zapier.com trigger method of sending tweets from Max is limited by number of tweets and sync rate. So it would be nice to set up another intermediary server program in ruby or php which eliminates the middle-man and just sends tweets directly.<\/p>\n<p>Or you could use the mxj searchTweet program, which has been updated to do this on the search side.<\/p>\n<h4>twitter gem<\/h4>\n<p>update: Got it working with this gem:\u00a0<a href=\"https:\/\/github.com\/sferik\/twitter\">https:\/\/github.com\/sferik\/twitter<\/a>. Its much easier than dealing with xively.<\/p>\n<p>docs:\u00a0<a href=\"http:\/\/rdoc.info\/gems\/twitter\">http:\/\/rdoc.info\/gems\/twitter<\/a><\/p>\n<p>how to destroy a tweet:\u00a0<a style=\"line-height: 1.6;\" href=\"http:\/\/stackoverflow.com\/questions\/10640811\/twitter-gem-how-to-get-the-id-of-a-new-tweet\">http:\/\/stackoverflow.com\/questions\/10640811\/twitter-gem-how-to-get-the-id-of-a-new-tweet<\/a><\/p>\n<p>how to get a timeline:\u00a0<a style=\"line-height: 1.6;\" href=\"http:\/\/bobbyprabowo.wordpress.com\/2010\/01\/01\/simple-twitter-gem-tutorial\/\">http:\/\/bobbyprabowo.wordpress.com\/2010\/01\/01\/simple-twitter-gem-tutorial\/<\/a><\/p>\n<p>example of error handling code:<\/p>\n<pre class=\"brush: ruby; gutter: true\">MAX_ATTEMPTS = 3\r\nnum_attempts = 0\r\nbegin\r\n  num_attempts += 1\r\n  retweets = Twitter.retweeted_by_user(&quot;sferik&quot;)\r\nrescue Twitter::Error::TooManyRequests =&gt; error\r\n  if num_attempts &lt;= MAX_ATTEMPTS\r\n    # NOTE: Your process could go to sleep for up to 15 minutes but if you\r\n    # retry any sooner, it will almost certainly fail with the same exception.\r\n    sleep error.rate_limit.reset_in\r\n    retry\r\n  else\r\n    raise\r\n  end\r\nend<\/pre>\n<p>&nbsp;<\/p>\n<p>Another useful SO post:\u00a0<a style=\"line-height: 1.6;\" href=\"http:\/\/stackoverflow.com\/questions\/16618037\/twitter-rate-limit-hit-while-requesting-friends-with-ruby-gem\/16620639#16620639\">http:\/\/stackoverflow.com\/questions\/16618037\/twitter-rate-limit-hit-while-requesting-friends-with-ruby-gem\/16620639#16620639<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update 6\/2014: working version here:\u00a0https:\/\/reactivemusic.net\/?p=7013 notes The zapier.com trigger method of sending tweets from Max is limited by number of tweets and sync rate. So it would be nice to set up another intermediary server program in ruby or php which eliminates the middle-man and just sends tweets directly. Or you could use the mxj &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/reactivemusic.net\/?p=6934\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Tweet from Max with ruby&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[143,28],"tags":[161,191,345,296,223,190,136],"class_list":["post-6934","post","type-post","status-publish","format-standard","hentry","category-interactive-media-art","category-maxmsp","tag-api","tag-favorites","tag-maxmsp","tag-notebook","tag-oauth","tag-portfolio","tag-twitter"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Tweet from Max with ruby  - reactive music<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/reactivemusic.net\/?p=6934\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tweet from Max with ruby  - reactive music\" \/>\n<meta property=\"og:description\" content=\"Update 6\/2014: working version here:\u00a0https:\/\/reactivemusic.net\/?p=7013 notes The zapier.com trigger method of sending tweets from Max is limited by number of tweets and sync rate. So it would be nice to set up another intermediary server program in ruby or php which eliminates the middle-man and just sends tweets directly. Or you could use the mxj &hellip; Continue reading &quot;Tweet from Max with ruby&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/reactivemusic.net\/?p=6934\" \/>\n<meta property=\"og:site_name\" content=\"reactive music\" \/>\n<meta property=\"article:published_time\" content=\"2013-09-03T03:51:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-06-25T17:57:17+00:00\" \/>\n<meta name=\"author\" content=\"Tom Zicarelli\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tom Zicarelli\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=6934#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=6934\"},\"author\":{\"name\":\"Tom Zicarelli\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\"},\"headline\":\"Tweet from Max with ruby\",\"datePublished\":\"2013-09-03T03:51:28+00:00\",\"dateModified\":\"2014-06-25T17:57:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=6934\"},\"wordCount\":140,\"keywords\":[\"API\",\"favorites\",\"Max\\\/MSP\",\"notebook\",\"oauth\",\"portfolio\",\"Twitter\"],\"articleSection\":[\"interactive media art\",\"Max\\\/MSP\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=6934\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/?p=6934\",\"name\":\"Tweet from Max with ruby - reactive music\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#website\"},\"datePublished\":\"2013-09-03T03:51:28+00:00\",\"dateModified\":\"2014-06-25T17:57:17+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=6934#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/reactivemusic.net\\\/?p=6934\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=6934#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/reactivemusic.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tweet from Max with ruby\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#website\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/\",\"name\":\"reactive music\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/reactivemusic.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\",\"name\":\"Tom Zicarelli\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g\",\"caption\":\"Tom Zicarelli\"},\"sameAs\":[\"http:\\\/\\\/tomzicarelli.com\"],\"url\":\"https:\\\/\\\/reactivemusic.net\\\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tweet from Max with ruby  - reactive music","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/reactivemusic.net\/?p=6934","og_locale":"en_US","og_type":"article","og_title":"Tweet from Max with ruby  - reactive music","og_description":"Update 6\/2014: working version here:\u00a0https:\/\/reactivemusic.net\/?p=7013 notes The zapier.com trigger method of sending tweets from Max is limited by number of tweets and sync rate. So it would be nice to set up another intermediary server program in ruby or php which eliminates the middle-man and just sends tweets directly. Or you could use the mxj &hellip; Continue reading \"Tweet from Max with ruby\"","og_url":"https:\/\/reactivemusic.net\/?p=6934","og_site_name":"reactive music","article_published_time":"2013-09-03T03:51:28+00:00","article_modified_time":"2014-06-25T17:57:17+00:00","author":"Tom Zicarelli","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Tom Zicarelli","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/reactivemusic.net\/?p=6934#article","isPartOf":{"@id":"https:\/\/reactivemusic.net\/?p=6934"},"author":{"name":"Tom Zicarelli","@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571"},"headline":"Tweet from Max with ruby","datePublished":"2013-09-03T03:51:28+00:00","dateModified":"2014-06-25T17:57:17+00:00","mainEntityOfPage":{"@id":"https:\/\/reactivemusic.net\/?p=6934"},"wordCount":140,"keywords":["API","favorites","Max\/MSP","notebook","oauth","portfolio","Twitter"],"articleSection":["interactive media art","Max\/MSP"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/reactivemusic.net\/?p=6934","url":"https:\/\/reactivemusic.net\/?p=6934","name":"Tweet from Max with ruby - reactive music","isPartOf":{"@id":"https:\/\/reactivemusic.net\/#website"},"datePublished":"2013-09-03T03:51:28+00:00","dateModified":"2014-06-25T17:57:17+00:00","author":{"@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571"},"breadcrumb":{"@id":"https:\/\/reactivemusic.net\/?p=6934#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/reactivemusic.net\/?p=6934"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/reactivemusic.net\/?p=6934#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/reactivemusic.net\/"},{"@type":"ListItem","position":2,"name":"Tweet from Max with ruby"}]},{"@type":"WebSite","@id":"https:\/\/reactivemusic.net\/#website","url":"https:\/\/reactivemusic.net\/","name":"reactive music","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/reactivemusic.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571","name":"Tom Zicarelli","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g","caption":"Tom Zicarelli"},"sameAs":["http:\/\/tomzicarelli.com"],"url":"https:\/\/reactivemusic.net\/?author=2"}]}},"_links":{"self":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/6934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6934"}],"version-history":[{"count":22,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/6934\/revisions"}],"predecessor-version":[{"id":16874,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/6934\/revisions\/16874"}],"wp:attachment":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}