{"action":"created","issue":{"url":"https://api.github.com/repos/plaid/plaid-ruby/issues/91","repository_url":"https://api.github.com/repos/plaid/plaid-ruby","labels_url":"https://api.github.com/repos/plaid/plaid-ruby/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/plaid/plaid-ruby/issues/91/comments","events_url":"https://api.github.com/repos/plaid/plaid-ruby/issues/91/events","html_url":"https://github.com/plaid/plaid-ruby/pull/91","id":119781249,"number":91,"title":"Clear existing transactions before setting them on the user","user":{"login":"daaaveg","id":666038,"avatar_url":"https://avatars.githubusercontent.com/u/666038?v=3","gravatar_id":"","url":"https://api.github.com/users/daaaveg","html_url":"https://github.com/daaaveg","followers_url":"https://api.github.com/users/daaaveg/followers","following_url":"https://api.github.com/users/daaaveg/following{/other_user}","gists_url":"https://api.github.com/users/daaaveg/gists{/gist_id}","starred_url":"https://api.github.com/users/daaaveg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daaaveg/subscriptions","organizations_url":"https://api.github.com/users/daaaveg/orgs","repos_url":"https://api.github.com/users/daaaveg/repos","events_url":"https://api.github.com/users/daaaveg/events{/privacy}","received_events_url":"https://api.github.com/users/daaaveg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-01T18:44:43Z","updated_at":"2016-05-06T05:01:38Z","closed_at":"2016-05-06T05:01:38Z","pull_request":{"url":"https://api.github.com/repos/plaid/plaid-ruby/pulls/91","html_url":"https://github.com/plaid/plaid-ruby/pull/91","diff_url":"https://github.com/plaid/plaid-ruby/pull/91.diff","patch_url":"https://github.com/plaid/plaid-ruby/pull/91.patch"},"body":"I'm running into an issue where each time `user.get('connect')` is called the transactions are getting duplicated. I can't figure out a way to pass the `pending: true` option in with `Plaid.set_user()` so I have to call `user.get('connect', {options: {pending: true}.to_json})` after I set the user to grab the pending transactions. When this happens it's duplicating the transactions\r\n\r\nYou can verify this using:\r\n```\r\n2.1.2 :007 > user = Plaid.set_user(exchangeTokenResponse.access_token, ['connect'])\r\n2.1.2 :008 > user.transactions.size\r\n => 16\r\n2.1.2 :009 > user.get('connect')\r\n2.1.2 :010 > user.transactions.size\r\n => 32\r\n2.1.2 :011 > user.get('connect')\r\n2.1.2 :012 > user.transactions.size\r\n => 48\r\n```\r\n\r\nThis change clears the existing transactions by setting `self.transactions = []` before setting the transactions from the response. \r\n\r\nI'm not sure if the `if self.transactions.any? { |t| t == transaction['_id'] }` check is supposed to be doing this, but it doesn't seem to be working. I think just clearing the transactions will be faster too, since you won't have to search through the existing transactions to see if each transaction in the response already exists. "},"comment":{"url":"https://api.github.com/repos/plaid/plaid-ruby/issues/comments/217348739","html_url":"https://github.com/plaid/plaid-ruby/pull/91#issuecomment-217348739","issue_url":"https://api.github.com/repos/plaid/plaid-ruby/issues/91","id":217348739,"user":{"login":"be9","id":920,"avatar_url":"https://avatars.githubusercontent.com/u/920?v=3","gravatar_id":"","url":"https://api.github.com/users/be9","html_url":"https://github.com/be9","followers_url":"https://api.github.com/users/be9/followers","following_url":"https://api.github.com/users/be9/following{/other_user}","gists_url":"https://api.github.com/users/be9/gists{/gist_id}","starred_url":"https://api.github.com/users/be9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/be9/subscriptions","organizations_url":"https://api.github.com/users/be9/orgs","repos_url":"https://api.github.com/users/be9/repos","events_url":"https://api.github.com/users/be9/events{/privacy}","received_events_url":"https://api.github.com/users/be9/received_events","type":"User","site_admin":false},"created_at":"2016-05-06T05:01:38Z","updated_at":"2016-05-06T05:01:38Z","body":"The logic of retrieving and caching transactions has changed in the major rewrite of the library which has just been released as 2.0.0.alpha. The `User#transactions` method doesn't cache anything now.\r\n\r\nClosing this as outdated."}}