{"action":"created","comment":{"url":"https://api.github.com/repos/solidusio/solidus/pulls/comments/57732994","id":57732994,"diff_hunk":"@@ -0,0 +1,42 @@\n+module Spree\n+  class LineItem\n+    # Pricers for line items expose `#price`, returning a `Spree::Money` or `Money` object,\n+    # and are used to choose or calculate the correct price for a line item.\n+    # Ideally, they are idempotent, that is: When run on the same line item, they will return\n+    # the same price.\n+    #\n+    module Pricers\n+      # The `Abstract` pricer is here for other pricers to inherit from. It defines the common\n+      # interface for pricers, as well as two practical errors, `VariantMissing` and\n+      # `CurrencyMissing`.\n+      #\n+      # @attr [Spree::LineItem] The line item to calculate or choose a price for\n+      class Abstract\n+        class VariantMissing < StandardError; end\n+        class CurrencyMissing < StandardError; end\n+\n+        attr_reader :line_item\n+\n+        def initialize(line_item)\n+          @line_item = line_item\n+        end\n+\n+        # Returns the calculated or chosen price\n+        #\n+        # @return [Spree::Money, Money] an money object representing line item's price","path":"core/app/models/spree/line_item/pricers/abstract.rb","position":26,"original_position":26,"commit_id":"3a65e7a710664cb89c8220906dfe5d5ce2471371","original_commit_id":"3a65e7a710664cb89c8220906dfe5d5ce2471371","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":"A pricer's return value will be sent `to_d` and `currency`, expecting `::Money`s signature. I thought I'd allow a plain money object to start phasing out `Spree::Money`. ","created_at":"2016-03-29T14:31:33Z","updated_at":"2016-03-29T14:31:33Z","html_url":"https://github.com/solidusio/solidus/pull/994#discussion_r57732994","pull_request_url":"https://api.github.com/repos/solidusio/solidus/pulls/994","_links":{"self":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/comments/57732994"},"html":{"href":"https://github.com/solidusio/solidus/pull/994#discussion_r57732994"},"pull_request":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/994"}}},"pull_request":{"url":"https://api.github.com/repos/solidusio/solidus/pulls/994","id":63435806,"html_url":"https://github.com/solidusio/solidus/pull/994","diff_url":"https://github.com/solidusio/solidus/pull/994.diff","patch_url":"https://github.com/solidusio/solidus/pull/994.patch","issue_url":"https://api.github.com/repos/solidusio/solidus/issues/994","number":994,"state":"open","locked":false,"title":"Conservative line item 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":"This is the pricer that does what `LineItem` does most of the time: Not change anything if there is a price, and if there isn't, take the one from the variant. \r\n\r\nIt's modified a little bit so that it would always take the price in the currency from the current order/line item, but otherwise very much the same behaviour. \r\n\r\nStay tuned for more `Pricers`!","created_at":"2016-03-18T21:01:37Z","updated_at":"2016-03-29T14:31:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba7246e065820efdb782159e4062a6a60053f7b8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/solidusio/solidus/pulls/994/commits","review_comments_url":"https://api.github.com/repos/solidusio/solidus/pulls/994/comments","review_comment_url":"https://api.github.com/repos/solidusio/solidus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/solidusio/solidus/issues/994/comments","statuses_url":"https://api.github.com/repos/solidusio/solidus/statuses/3a65e7a710664cb89c8220906dfe5d5ce2471371","head":{"label":"magiclabs:0318-conservative-line-item-pricer","ref":"0318-conservative-line-item-pricer","sha":"3a65e7a710664cb89c8220906dfe5d5ce2471371","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-03-26T14:15:55Z","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":66321,"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":"60ee1dffc7c3932cd7652cc2b4566f08a12f74b8","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-03-28T18:38:20Z","pushed_at":"2016-03-28T16:01:50Z","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":68274,"stargazers_count":862,"watchers_count":862,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":221,"mirror_url":null,"open_issues_count":118,"forks":221,"open_issues":118,"watchers":862,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/994"},"html":{"href":"https://github.com/solidusio/solidus/pull/994"},"issue":{"href":"https://api.github.com/repos/solidusio/solidus/issues/994"},"comments":{"href":"https://api.github.com/repos/solidusio/solidus/issues/994/comments"},"review_comments":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/994/comments"},"review_comment":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/994/commits"},"statuses":{"href":"https://api.github.com/repos/solidusio/solidus/statuses/3a65e7a710664cb89c8220906dfe5d5ce2471371"}}}}