{"action":"created","comment":{"url":"https://api.github.com/repos/solidusio/solidus/pulls/comments/60404189","id":60404189,"diff_hunk":"@@ -214,12 +222,39 @@ def option_value(opt_name)\n       option_values.detect { |o| o.option_type.name == opt_name }.try(:presentation)\n     end\n \n+    # Returns an instance of the globally configured variant pricer class for this variant.\n+    # It's cached so we don't create too many objects.\n+    #\n+    # @return [Spree::Variant::Pricer] The default pricer class\n+    def pricer\n+      @pricer ||= Spree::Config.variant_pricer_class.new(self)\n+    end\n+\n+    # Chooses an appropriate price for the given pricing options\n+    #\n+    # @see Spree::Variant::Pricer#price_for\n+    # @param [Spree::Config.pricing_options_class] An instance of pricing options\n+    # @return [Spree::Money] The chosen price as a Money object\n+    delegate :price_for, to: :pricer\n+\n+    # Returns the difference in price from the master variant\n+    def price_difference_from_master(pricing_options = Spreee::Config.default_pricing_options)","path":"core/app/models/spree/variant.rb","position":35,"original_position":35,"commit_id":"a9af64fa384d935ff1c0b1f69a59f554a0aa15a7","original_commit_id":"a9af64fa384d935ff1c0b1f69a59f554a0aa15a7","user":{"login":"mamhoff","id":703401,"avatar_url":"https://avatars.githubusercontent.com/u/703401?v=3","gravatar_id":"","url":"https://api.github.com/users/mamhoff","html_url":"https://github.com/mamhoff","followers_url":"https://api.github.com/users/mamhoff/followers","following_url":"https://api.github.com/users/mamhoff/following{/other_user}","gists_url":"https://api.github.com/users/mamhoff/gists{/gist_id}","starred_url":"https://api.github.com/users/mamhoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mamhoff/subscriptions","organizations_url":"https://api.github.com/users/mamhoff/orgs","repos_url":"https://api.github.com/users/mamhoff/repos","events_url":"https://api.github.com/users/mamhoff/events{/privacy}","received_events_url":"https://api.github.com/users/mamhoff/received_events","type":"User","site_admin":false},"body":"`Spreee` does not work. ","created_at":"2016-04-20T13:15:27Z","updated_at":"2016-04-20T13:15:27Z","html_url":"https://github.com/solidusio/solidus/pull/1071#discussion_r60404189","pull_request_url":"https://api.github.com/repos/solidusio/solidus/pulls/1071","_links":{"self":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/comments/60404189"},"html":{"href":"https://github.com/solidusio/solidus/pull/1071#discussion_r60404189"},"pull_request":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/1071"}}},"pull_request":{"url":"https://api.github.com/repos/solidusio/solidus/pulls/1071","id":66612611,"html_url":"https://github.com/solidusio/solidus/pull/1071","diff_url":"https://github.com/solidusio/solidus/pull/1071.diff","patch_url":"https://github.com/solidusio/solidus/pull/1071.patch","issue_url":"https://api.github.com/repos/solidusio/solidus/issues/1071","number":1071,"state":"open","locked":false,"title":"Current price options and variant pricer","user":{"login":"mamhoff","id":703401,"avatar_url":"https://avatars.githubusercontent.com/u/703401?v=3","gravatar_id":"","url":"https://api.github.com/users/mamhoff","html_url":"https://github.com/mamhoff","followers_url":"https://api.github.com/users/mamhoff/followers","following_url":"https://api.github.com/users/mamhoff/following{/other_user}","gists_url":"https://api.github.com/users/mamhoff/gists{/gist_id}","starred_url":"https://api.github.com/users/mamhoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mamhoff/subscriptions","organizations_url":"https://api.github.com/users/mamhoff/orgs","repos_url":"https://api.github.com/users/mamhoff/repos","events_url":"https://api.github.com/users/mamhoff/events{/privacy}","received_events_url":"https://api.github.com/users/mamhoff/received_events","type":"User","site_admin":false},"body":"First off: I'm deeply sorry for the humoungousness of this PR. \r\n\r\nThis will allow us to use different things than just the currency for selecting prices. In order to do that, we add a `PricingOptions` module and a corresponding `Pricer` which will take the desired attributes from the pricing options module and yield a price. \r\n\r\nSince `current_currency` has also been used in availability and search scopes, those scopes also had to be touched (and tested). \r\n\r\nThere were a couple of helpers doing really strange stuff in general. I did clean those up a little, because without that this feature wouldn't have worked either. \r\n\r\nAt the end of this, I deprecate the  use of `current_currency` because there should be only one source of truth. \r\n\r\nI restructured the PR a bit to a) exclude `Spree::Money` being able to add and subtract and b) include getting rid of the line item pricers, which serve no perceptible purpose now that variant pricers exist. ","created_at":"2016-04-15T09:17:42Z","updated_at":"2016-04-20T13:15:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9249c39f3261bd6abb2469b54d97b7c00e30df6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/solidusio/solidus/pulls/1071/commits","review_comments_url":"https://api.github.com/repos/solidusio/solidus/pulls/1071/comments","review_comment_url":"https://api.github.com/repos/solidusio/solidus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/solidusio/solidus/issues/1071/comments","statuses_url":"https://api.github.com/repos/solidusio/solidus/statuses/a9af64fa384d935ff1c0b1f69a59f554a0aa15a7","head":{"label":"magiclabs:current-price-options-and-variant-pricer","ref":"current-price-options-and-variant-pricer","sha":"a9af64fa384d935ff1c0b1f69a59f554a0aa15a7","user":{"login":"magiclabs","id":714995,"avatar_url":"https://avatars.githubusercontent.com/u/714995?v=3","gravatar_id":"","url":"https://api.github.com/users/magiclabs","html_url":"https://github.com/magiclabs","followers_url":"https://api.github.com/users/magiclabs/followers","following_url":"https://api.github.com/users/magiclabs/following{/other_user}","gists_url":"https://api.github.com/users/magiclabs/gists{/gist_id}","starred_url":"https://api.github.com/users/magiclabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magiclabs/subscriptions","organizations_url":"https://api.github.com/users/magiclabs/orgs","repos_url":"https://api.github.com/users/magiclabs/repos","events_url":"https://api.github.com/users/magiclabs/events{/privacy}","received_events_url":"https://api.github.com/users/magiclabs/received_events","type":"Organization","site_admin":false},"repo":{"id":45269516,"name":"solidus","full_name":"magiclabs/solidus","owner":{"login":"magiclabs","id":714995,"avatar_url":"https://avatars.githubusercontent.com/u/714995?v=3","gravatar_id":"","url":"https://api.github.com/users/magiclabs","html_url":"https://github.com/magiclabs","followers_url":"https://api.github.com/users/magiclabs/followers","following_url":"https://api.github.com/users/magiclabs/following{/other_user}","gists_url":"https://api.github.com/users/magiclabs/gists{/gist_id}","starred_url":"https://api.github.com/users/magiclabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magiclabs/subscriptions","organizations_url":"https://api.github.com/users/magiclabs/orgs","repos_url":"https://api.github.com/users/magiclabs/repos","events_url":"https://api.github.com/users/magiclabs/events{/privacy}","received_events_url":"https://api.github.com/users/magiclabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/magiclabs/solidus","description":"Solidus, Rails eCommerce System","fork":true,"url":"https://api.github.com/repos/magiclabs/solidus","forks_url":"https://api.github.com/repos/magiclabs/solidus/forks","keys_url":"https://api.github.com/repos/magiclabs/solidus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/magiclabs/solidus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/magiclabs/solidus/teams","hooks_url":"https://api.github.com/repos/magiclabs/solidus/hooks","issue_events_url":"https://api.github.com/repos/magiclabs/solidus/issues/events{/number}","events_url":"https://api.github.com/repos/magiclabs/solidus/events","assignees_url":"https://api.github.com/repos/magiclabs/solidus/assignees{/user}","branches_url":"https://api.github.com/repos/magiclabs/solidus/branches{/branch}","tags_url":"https://api.github.com/repos/magiclabs/solidus/tags","blobs_url":"https://api.github.com/repos/magiclabs/solidus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/magiclabs/solidus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/magiclabs/solidus/git/refs{/sha}","trees_url":"https://api.github.com/repos/magiclabs/solidus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/magiclabs/solidus/statuses/{sha}","languages_url":"https://api.github.com/repos/magiclabs/solidus/languages","stargazers_url":"https://api.github.com/repos/magiclabs/solidus/stargazers","contributors_url":"https://api.github.com/repos/magiclabs/solidus/contributors","subscribers_url":"https://api.github.com/repos/magiclabs/solidus/subscribers","subscription_url":"https://api.github.com/repos/magiclabs/solidus/subscription","commits_url":"https://api.github.com/repos/magiclabs/solidus/commits{/sha}","git_commits_url":"https://api.github.com/repos/magiclabs/solidus/git/commits{/sha}","comments_url":"https://api.github.com/repos/magiclabs/solidus/comments{/number}","issue_comment_url":"https://api.github.com/repos/magiclabs/solidus/issues/comments{/number}","contents_url":"https://api.github.com/repos/magiclabs/solidus/contents/{+path}","compare_url":"https://api.github.com/repos/magiclabs/solidus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/magiclabs/solidus/merges","archive_url":"https://api.github.com/repos/magiclabs/solidus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/magiclabs/solidus/downloads","issues_url":"https://api.github.com/repos/magiclabs/solidus/issues{/number}","pulls_url":"https://api.github.com/repos/magiclabs/solidus/pulls{/number}","milestones_url":"https://api.github.com/repos/magiclabs/solidus/milestones{/number}","notifications_url":"https://api.github.com/repos/magiclabs/solidus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/magiclabs/solidus/labels{/name}","releases_url":"https://api.github.com/repos/magiclabs/solidus/releases{/id}","deployments_url":"https://api.github.com/repos/magiclabs/solidus/deployments","created_at":"2015-10-30T18:34:37Z","updated_at":"2016-01-21T21:16:31Z","pushed_at":"2016-04-20T07:53:57Z","git_url":"git://github.com/magiclabs/solidus.git","ssh_url":"git@github.com:magiclabs/solidus.git","clone_url":"https://github.com/magiclabs/solidus.git","svn_url":"https://github.com/magiclabs/solidus","homepage":"http://solidus.io/","size":66757,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"solidusio:master","ref":"master","sha":"c0bcd30e09f922109ac1c1018d93e606d7257227","user":{"login":"solidusio","id":11045486,"avatar_url":"https://avatars.githubusercontent.com/u/11045486?v=3","gravatar_id":"","url":"https://api.github.com/users/solidusio","html_url":"https://github.com/solidusio","followers_url":"https://api.github.com/users/solidusio/followers","following_url":"https://api.github.com/users/solidusio/following{/other_user}","gists_url":"https://api.github.com/users/solidusio/gists{/gist_id}","starred_url":"https://api.github.com/users/solidusio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solidusio/subscriptions","organizations_url":"https://api.github.com/users/solidusio/orgs","repos_url":"https://api.github.com/users/solidusio/repos","events_url":"https://api.github.com/users/solidusio/events{/privacy}","received_events_url":"https://api.github.com/users/solidusio/received_events","type":"Organization","site_admin":false},"repo":{"id":30985840,"name":"solidus","full_name":"solidusio/solidus","owner":{"login":"solidusio","id":11045486,"avatar_url":"https://avatars.githubusercontent.com/u/11045486?v=3","gravatar_id":"","url":"https://api.github.com/users/solidusio","html_url":"https://github.com/solidusio","followers_url":"https://api.github.com/users/solidusio/followers","following_url":"https://api.github.com/users/solidusio/following{/other_user}","gists_url":"https://api.github.com/users/solidusio/gists{/gist_id}","starred_url":"https://api.github.com/users/solidusio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solidusio/subscriptions","organizations_url":"https://api.github.com/users/solidusio/orgs","repos_url":"https://api.github.com/users/solidusio/repos","events_url":"https://api.github.com/users/solidusio/events{/privacy}","received_events_url":"https://api.github.com/users/solidusio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/solidusio/solidus","description":"Solidus, Rails eCommerce System","fork":false,"url":"https://api.github.com/repos/solidusio/solidus","forks_url":"https://api.github.com/repos/solidusio/solidus/forks","keys_url":"https://api.github.com/repos/solidusio/solidus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solidusio/solidus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solidusio/solidus/teams","hooks_url":"https://api.github.com/repos/solidusio/solidus/hooks","issue_events_url":"https://api.github.com/repos/solidusio/solidus/issues/events{/number}","events_url":"https://api.github.com/repos/solidusio/solidus/events","assignees_url":"https://api.github.com/repos/solidusio/solidus/assignees{/user}","branches_url":"https://api.github.com/repos/solidusio/solidus/branches{/branch}","tags_url":"https://api.github.com/repos/solidusio/solidus/tags","blobs_url":"https://api.github.com/repos/solidusio/solidus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solidusio/solidus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solidusio/solidus/git/refs{/sha}","trees_url":"https://api.github.com/repos/solidusio/solidus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solidusio/solidus/statuses/{sha}","languages_url":"https://api.github.com/repos/solidusio/solidus/languages","stargazers_url":"https://api.github.com/repos/solidusio/solidus/stargazers","contributors_url":"https://api.github.com/repos/solidusio/solidus/contributors","subscribers_url":"https://api.github.com/repos/solidusio/solidus/subscribers","subscription_url":"https://api.github.com/repos/solidusio/solidus/subscription","commits_url":"https://api.github.com/repos/solidusio/solidus/commits{/sha}","git_commits_url":"https://api.github.com/repos/solidusio/solidus/git/commits{/sha}","comments_url":"https://api.github.com/repos/solidusio/solidus/comments{/number}","issue_comment_url":"https://api.github.com/repos/solidusio/solidus/issues/comments{/number}","contents_url":"https://api.github.com/repos/solidusio/solidus/contents/{+path}","compare_url":"https://api.github.com/repos/solidusio/solidus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solidusio/solidus/merges","archive_url":"https://api.github.com/repos/solidusio/solidus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solidusio/solidus/downloads","issues_url":"https://api.github.com/repos/solidusio/solidus/issues{/number}","pulls_url":"https://api.github.com/repos/solidusio/solidus/pulls{/number}","milestones_url":"https://api.github.com/repos/solidusio/solidus/milestones{/number}","notifications_url":"https://api.github.com/repos/solidusio/solidus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solidusio/solidus/labels{/name}","releases_url":"https://api.github.com/repos/solidusio/solidus/releases{/id}","deployments_url":"https://api.github.com/repos/solidusio/solidus/deployments","created_at":"2015-02-18T20:41:58Z","updated_at":"2016-04-20T08:39:17Z","pushed_at":"2016-04-20T07:53:57Z","git_url":"git://github.com/solidusio/solidus.git","ssh_url":"git@github.com:solidusio/solidus.git","clone_url":"https://github.com/solidusio/solidus.git","svn_url":"https://github.com/solidusio/solidus","homepage":"http://solidus.io/","size":68658,"stargazers_count":895,"watchers_count":895,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":238,"mirror_url":null,"open_issues_count":97,"forks":238,"open_issues":97,"watchers":895,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/1071"},"html":{"href":"https://github.com/solidusio/solidus/pull/1071"},"issue":{"href":"https://api.github.com/repos/solidusio/solidus/issues/1071"},"comments":{"href":"https://api.github.com/repos/solidusio/solidus/issues/1071/comments"},"review_comments":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/1071/comments"},"review_comment":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/1071/commits"},"statuses":{"href":"https://api.github.com/repos/solidusio/solidus/statuses/a9af64fa384d935ff1c0b1f69a59f554a0aa15a7"}}}}