{"action":"created","comment":{"url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/comments/30863039","id":30863039,"diff_hunk":"@@ -233,18 +237,30 @@ def cache_key(package)\n           order = package.order\n           ship_address = package.order.ship_address\n           contents_hash = Digest::MD5.hexdigest(package.contents.map {|content_item| content_item.variant.id.to_s + \"_\" + content_item.quantity.to_s }.join(\"|\"))\n-          @cache_key = \"#{stock_location}#{carrier.name}-#{order.number}-#{ship_address.country.iso}-#{fetch_best_state_from_address(ship_address)}-#{ship_address.city}-#{ship_address.zipcode}-#{contents_hash}-#{I18n.locale}\".gsub(\" \",\"\")\n+          @cache_key = \"#{stock_location}#{carrier.name}-#{order.number}-#{ship_address.country.iso}-#{ship_address.state_text}-#{ship_address.city}-#{ship_address.zipcode}-#{contents_hash}-#{I18n.locale}\".gsub(\" \",\"\")","path":"app/models/spree/calculator/shipping/active_shipping/base.rb","position":55,"original_position":53,"commit_id":"460f36b959a385645d44d5506f8930a5655f6f00","original_commit_id":"ab1df16180348acfaf3dc7e786637b5b4a378fed","user":{"login":"mbj","id":117966,"avatar_url":"https://avatars.githubusercontent.com/u/117966?v=3","gravatar_id":"","url":"https://api.github.com/users/mbj","html_url":"https://github.com/mbj","followers_url":"https://api.github.com/users/mbj/followers","following_url":"https://api.github.com/users/mbj/following{/other_user}","gists_url":"https://api.github.com/users/mbj/gists{/gist_id}","starred_url":"https://api.github.com/users/mbj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbj/subscriptions","organizations_url":"https://api.github.com/users/mbj/orgs","repos_url":"https://api.github.com/users/mbj/repos","events_url":"https://api.github.com/users/mbj/events{/privacy}","received_events_url":"https://api.github.com/users/mbj/received_events","type":"User","site_admin":false},"body":"I wounder if this code would be much easier to understand in case we'd build up an array of string components that form the key and than `join('-')` it together.\r\n\r\n```\r\n[\r\n  stock_location,\r\n  carrier_name,\r\n  order.number,\r\n  ...,\r\n].join('-').gsub(' ', '')","created_at":"2015-05-22T01:05:44Z","updated_at":"2015-05-22T01:05:44Z","html_url":"https://github.com/MountainRoseHerbs/spree_active_shipping/pull/1#discussion_r30863039","pull_request_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/comments/30863039"},"html":{"href":"https://github.com/MountainRoseHerbs/spree_active_shipping/pull/1#discussion_r30863039"},"pull_request":{"href":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/1","id":35876251,"html_url":"https://github.com/MountainRoseHerbs/spree_active_shipping/pull/1","diff_url":"https://github.com/MountainRoseHerbs/spree_active_shipping/pull/1.diff","patch_url":"https://github.com/MountainRoseHerbs/spree_active_shipping/pull/1.patch","issue_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/issues/1","number":1,"state":"open","locked":false,"title":"Restrict PO box shipping","user":{"login":"dkubb","id":133,"avatar_url":"https://avatars.githubusercontent.com/u/133?v=3","gravatar_id":"","url":"https://api.github.com/users/dkubb","html_url":"https://github.com/dkubb","followers_url":"https://api.github.com/users/dkubb/followers","following_url":"https://api.github.com/users/dkubb/following{/other_user}","gists_url":"https://api.github.com/users/dkubb/gists{/gist_id}","starred_url":"https://api.github.com/users/dkubb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkubb/subscriptions","organizations_url":"https://api.github.com/users/dkubb/orgs","repos_url":"https://api.github.com/users/dkubb/repos","events_url":"https://api.github.com/users/dkubb/events{/privacy}","received_events_url":"https://api.github.com/users/dkubb/received_events","type":"User","site_admin":false},"body":"This branch will restrict PO Box shipping to just USPS and Canada Post.\r\n\r\nBoth Fedex and UPS cannot ship directly to a PO Box via their regular shipping methods. They both have special services that can ([SmartPost](http://www.fedex.com/us/smart-post/) and [SurePost](https://www.ups.com/content/us/en/resources/track/sp_definition.html) respectively), but those are not supported by ActiveShipping afaik.\r\n\r\n### TODO\r\n\r\n* [x] Add `Spree::AddressLine` to normalize and validate the address line\r\n  * [x] Add `#pm_box?` to identify if an address line indicates a PO Box\r\n* [x] Use `Spree::AddressLine` to setup the `ActiveShipping::Location` object\r\n* [x] Add config setting that is tested to see if the carrier can ship to PO Boxes\r\n  * [x] Base (`false`, default)\r\n  * [x] USPS (`true`)\r\n  * [x] Canada Post (`true`)","created_at":"2015-05-20T21:07:16Z","updated_at":"2015-05-22T01:05:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3e853d9c53e215d0320c7d74b51572243dc7e58","assignee":{"login":"dkubb","id":133,"avatar_url":"https://avatars.githubusercontent.com/u/133?v=3","gravatar_id":"","url":"https://api.github.com/users/dkubb","html_url":"https://github.com/dkubb","followers_url":"https://api.github.com/users/dkubb/followers","following_url":"https://api.github.com/users/dkubb/following{/other_user}","gists_url":"https://api.github.com/users/dkubb/gists{/gist_id}","starred_url":"https://api.github.com/users/dkubb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkubb/subscriptions","organizations_url":"https://api.github.com/users/dkubb/orgs","repos_url":"https://api.github.com/users/dkubb/repos","events_url":"https://api.github.com/users/dkubb/events{/privacy}","received_events_url":"https://api.github.com/users/dkubb/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/1/commits","review_comments_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/1/comments","review_comment_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/issues/1/comments","statuses_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/statuses/460f36b959a385645d44d5506f8930a5655f6f00","head":{"label":"MountainRoseHerbs:feature/2-3-stable-mrh/restrict-po-box-shipping","ref":"feature/2-3-stable-mrh/restrict-po-box-shipping","sha":"460f36b959a385645d44d5506f8930a5655f6f00","user":{"login":"MountainRoseHerbs","id":2074141,"avatar_url":"https://avatars.githubusercontent.com/u/2074141?v=3","gravatar_id":"","url":"https://api.github.com/users/MountainRoseHerbs","html_url":"https://github.com/MountainRoseHerbs","followers_url":"https://api.github.com/users/MountainRoseHerbs/followers","following_url":"https://api.github.com/users/MountainRoseHerbs/following{/other_user}","gists_url":"https://api.github.com/users/MountainRoseHerbs/gists{/gist_id}","starred_url":"https://api.github.com/users/MountainRoseHerbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MountainRoseHerbs/subscriptions","organizations_url":"https://api.github.com/users/MountainRoseHerbs/orgs","repos_url":"https://api.github.com/users/MountainRoseHerbs/repos","events_url":"https://api.github.com/users/MountainRoseHerbs/events{/privacy}","received_events_url":"https://api.github.com/users/MountainRoseHerbs/received_events","type":"Organization","site_admin":false},"repo":{"id":12955995,"name":"spree_active_shipping","full_name":"MountainRoseHerbs/spree_active_shipping","owner":{"login":"MountainRoseHerbs","id":2074141,"avatar_url":"https://avatars.githubusercontent.com/u/2074141?v=3","gravatar_id":"","url":"https://api.github.com/users/MountainRoseHerbs","html_url":"https://github.com/MountainRoseHerbs","followers_url":"https://api.github.com/users/MountainRoseHerbs/followers","following_url":"https://api.github.com/users/MountainRoseHerbs/following{/other_user}","gists_url":"https://api.github.com/users/MountainRoseHerbs/gists{/gist_id}","starred_url":"https://api.github.com/users/MountainRoseHerbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MountainRoseHerbs/subscriptions","organizations_url":"https://api.github.com/users/MountainRoseHerbs/orgs","repos_url":"https://api.github.com/users/MountainRoseHerbs/repos","events_url":"https://api.github.com/users/MountainRoseHerbs/events{/privacy}","received_events_url":"https://api.github.com/users/MountainRoseHerbs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MountainRoseHerbs/spree_active_shipping","description":"Spree integration for Shopify's active_shipping gem","fork":true,"url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping","forks_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/forks","keys_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/teams","hooks_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/hooks","issue_events_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/issues/events{/number}","events_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/events","assignees_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/assignees{/user}","branches_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/branches{/branch}","tags_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/tags","blobs_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/git/refs{/sha}","trees_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/statuses/{sha}","languages_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/languages","stargazers_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/stargazers","contributors_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/contributors","subscribers_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/subscribers","subscription_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/subscription","commits_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/commits{/sha}","git_commits_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/git/commits{/sha}","comments_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/comments{/number}","issue_comment_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/issues/comments{/number}","contents_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/contents/{+path}","compare_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/merges","archive_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/downloads","issues_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/issues{/number}","pulls_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls{/number}","milestones_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/milestones{/number}","notifications_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/labels{/name}","releases_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/releases{/id}","created_at":"2013-09-19T18:26:42Z","updated_at":"2014-09-01T20:06:41Z","pushed_at":"2015-05-22T01:03:25Z","git_url":"git://github.com/MountainRoseHerbs/spree_active_shipping.git","ssh_url":"git@github.com:MountainRoseHerbs/spree_active_shipping.git","clone_url":"https://github.com/MountainRoseHerbs/spree_active_shipping.git","svn_url":"https://github.com/MountainRoseHerbs/spree_active_shipping","homepage":"http://spreecommerce.com","size":1336,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"2-3-stable-mrh"}},"base":{"label":"MountainRoseHerbs:2-3-stable-mrh","ref":"2-3-stable-mrh","sha":"57f242a2318e5d6ee1db8a8e2b86b3d574ed8fdc","user":{"login":"MountainRoseHerbs","id":2074141,"avatar_url":"https://avatars.githubusercontent.com/u/2074141?v=3","gravatar_id":"","url":"https://api.github.com/users/MountainRoseHerbs","html_url":"https://github.com/MountainRoseHerbs","followers_url":"https://api.github.com/users/MountainRoseHerbs/followers","following_url":"https://api.github.com/users/MountainRoseHerbs/following{/other_user}","gists_url":"https://api.github.com/users/MountainRoseHerbs/gists{/gist_id}","starred_url":"https://api.github.com/users/MountainRoseHerbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MountainRoseHerbs/subscriptions","organizations_url":"https://api.github.com/users/MountainRoseHerbs/orgs","repos_url":"https://api.github.com/users/MountainRoseHerbs/repos","events_url":"https://api.github.com/users/MountainRoseHerbs/events{/privacy}","received_events_url":"https://api.github.com/users/MountainRoseHerbs/received_events","type":"Organization","site_admin":false},"repo":{"id":12955995,"name":"spree_active_shipping","full_name":"MountainRoseHerbs/spree_active_shipping","owner":{"login":"MountainRoseHerbs","id":2074141,"avatar_url":"https://avatars.githubusercontent.com/u/2074141?v=3","gravatar_id":"","url":"https://api.github.com/users/MountainRoseHerbs","html_url":"https://github.com/MountainRoseHerbs","followers_url":"https://api.github.com/users/MountainRoseHerbs/followers","following_url":"https://api.github.com/users/MountainRoseHerbs/following{/other_user}","gists_url":"https://api.github.com/users/MountainRoseHerbs/gists{/gist_id}","starred_url":"https://api.github.com/users/MountainRoseHerbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MountainRoseHerbs/subscriptions","organizations_url":"https://api.github.com/users/MountainRoseHerbs/orgs","repos_url":"https://api.github.com/users/MountainRoseHerbs/repos","events_url":"https://api.github.com/users/MountainRoseHerbs/events{/privacy}","received_events_url":"https://api.github.com/users/MountainRoseHerbs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MountainRoseHerbs/spree_active_shipping","description":"Spree integration for Shopify's active_shipping gem","fork":true,"url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping","forks_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/forks","keys_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/teams","hooks_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/hooks","issue_events_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/issues/events{/number}","events_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/events","assignees_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/assignees{/user}","branches_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/branches{/branch}","tags_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/tags","blobs_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/git/refs{/sha}","trees_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/statuses/{sha}","languages_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/languages","stargazers_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/stargazers","contributors_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/contributors","subscribers_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/subscribers","subscription_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/subscription","commits_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/commits{/sha}","git_commits_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/git/commits{/sha}","comments_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/comments{/number}","issue_comment_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/issues/comments{/number}","contents_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/contents/{+path}","compare_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/merges","archive_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/downloads","issues_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/issues{/number}","pulls_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls{/number}","milestones_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/milestones{/number}","notifications_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/labels{/name}","releases_url":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/releases{/id}","created_at":"2013-09-19T18:26:42Z","updated_at":"2014-09-01T20:06:41Z","pushed_at":"2015-05-22T01:03:25Z","git_url":"git://github.com/MountainRoseHerbs/spree_active_shipping.git","ssh_url":"git@github.com:MountainRoseHerbs/spree_active_shipping.git","clone_url":"https://github.com/MountainRoseHerbs/spree_active_shipping.git","svn_url":"https://github.com/MountainRoseHerbs/spree_active_shipping","homepage":"http://spreecommerce.com","size":1336,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"2-3-stable-mrh"}},"_links":{"self":{"href":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/1"},"html":{"href":"https://github.com/MountainRoseHerbs/spree_active_shipping/pull/1"},"issue":{"href":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/issues/1"},"comments":{"href":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/MountainRoseHerbs/spree_active_shipping/statuses/460f36b959a385645d44d5506f8930a5655f6f00"}}}}