{"action":"created","comment":{"url":"https://api.github.com/repos/allegro/ralph_pricing/pulls/comments/84869485","pull_request_review_id":5618568,"id":84869485,"diff_hunk":"@@ -0,0 +1,455 @@\n+# -*- coding: utf-8 -*-\n+\n+from __future__ import absolute_import\n+from __future__ import division\n+from __future__ import print_function\n+from __future__ import unicode_literals\n+\n+from datetime import datetime, timedelta\n+\n+from dateutil.relativedelta import relativedelta\n+from django.db import connection\n+from django.db.models import Sum\n+from drf_compound_fields.fields import DictField, ListField\n+from rest_framework import serializers\n+from rest_framework.authentication import TokenAuthentication\n+from rest_framework.permissions import IsAuthenticated\n+from rest_framework.response import Response\n+from rest_framework.serializers import Serializer\n+from rest_framework.views import APIView\n+\n+from ralph_scrooge.models import (\n+    BaseUsage,\n+    DailyCost,\n+    ServiceEnvironment,\n+    UsageType,\n+)\n+from ralph_scrooge.rest.auth import IsServiceOwner\n+\n+USAGE_COST_NUM_DIGITS = 2\n+USAGE_VALUE_NUM_DIGITS = 5\n+\n+\n+class ServiceEnvironmentCostsDeserializer(Serializer):\n+    service_uid = serializers.CharField()\n+    environment = serializers.CharField()\n+    date_from = serializers.DateField()\n+    date_to = serializers.DateField()\n+    group_by = serializers.CharField(default='day')","path":"src/ralph_scrooge/rest/service_environment_costs.py","position":38,"original_position":38,"commit_id":"1a09ad1243e6d6279fd89a741d970cb0fe192212","original_commit_id":"75be208859a39aa710f9fa3e6086b25527407218","user":{"login":"xor-xor","id":2082842,"avatar_url":"https://avatars.githubusercontent.com/u/2082842?v=3","gravatar_id":"","url":"https://api.github.com/users/xor-xor","html_url":"https://github.com/xor-xor","followers_url":"https://api.github.com/users/xor-xor/followers","following_url":"https://api.github.com/users/xor-xor/following{/other_user}","gists_url":"https://api.github.com/users/xor-xor/gists{/gist_id}","starred_url":"https://api.github.com/users/xor-xor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xor-xor/subscriptions","organizations_url":"https://api.github.com/users/xor-xor/orgs","repos_url":"https://api.github.com/users/xor-xor/repos","events_url":"https://api.github.com/users/xor-xor/events{/privacy}","received_events_url":"https://api.github.com/users/xor-xor/received_events","type":"User","site_admin":false},"body":"Done. Alghouth it leads me to define choices as:\r\n```\r\nGROUP_BY_CHOICES = (\r\n    ('day', 'day'),\r\n    ('month', 'month'),\r\n)\r\n```\r\n...which IMO looks kind of weird - but on the other hand, we get validation of this field for free, which is a good thing.","created_at":"2016-10-25T10:05:09Z","updated_at":"2016-10-25T10:05:09Z","html_url":"https://github.com/allegro/ralph_pricing/pull/530#discussion_r84869485","pull_request_url":"https://api.github.com/repos/allegro/ralph_pricing/pulls/530","_links":{"self":{"href":"https://api.github.com/repos/allegro/ralph_pricing/pulls/comments/84869485"},"html":{"href":"https://github.com/allegro/ralph_pricing/pull/530#discussion_r84869485"},"pull_request":{"href":"https://api.github.com/repos/allegro/ralph_pricing/pulls/530"}}},"pull_request":{"url":"https://api.github.com/repos/allegro/ralph_pricing/pulls/530","id":89379120,"html_url":"https://github.com/allegro/ralph_pricing/pull/530","diff_url":"https://github.com/allegro/ralph_pricing/pull/530.diff","patch_url":"https://github.com/allegro/ralph_pricing/pull/530.patch","issue_url":"https://api.github.com/repos/allegro/ralph_pricing/issues/530","number":530,"state":"open","locked":false,"title":"Add endpoint for fetching usage values/costs per day/month.","user":{"login":"xor-xor","id":2082842,"avatar_url":"https://avatars.githubusercontent.com/u/2082842?v=3","gravatar_id":"","url":"https://api.github.com/users/xor-xor","html_url":"https://github.com/xor-xor","followers_url":"https://api.github.com/users/xor-xor/followers","following_url":"https://api.github.com/users/xor-xor/following{/other_user}","gists_url":"https://api.github.com/users/xor-xor/gists{/gist_id}","starred_url":"https://api.github.com/users/xor-xor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xor-xor/subscriptions","organizations_url":"https://api.github.com/users/xor-xor/orgs","repos_url":"https://api.github.com/users/xor-xor/repos","events_url":"https://api.github.com/users/xor-xor/events{/privacy}","received_events_url":"https://api.github.com/users/xor-xor/received_events","type":"User","site_admin":false},"body":"Docs will be added once we will have this new `v0.10` hierarchy finally discussed. By that time, this endpoint should be considered as private and subject to changes.\r\n\r\nPlease note that in `v0.10` we are dropping support for auth tokens in TastyPie format - from now on, only tokens in DjRF's format will be accepted (`v0.9` supports both of them - i.e. the same token can be provided in two ways).","created_at":"2016-10-14T12:53:46Z","updated_at":"2016-10-25T10:05:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"042bb6c58a65d750da4304ab4dce3576250cbfa2","assignee":{"login":"mkurek","id":107437,"avatar_url":"https://avatars.githubusercontent.com/u/107437?v=3","gravatar_id":"","url":"https://api.github.com/users/mkurek","html_url":"https://github.com/mkurek","followers_url":"https://api.github.com/users/mkurek/followers","following_url":"https://api.github.com/users/mkurek/following{/other_user}","gists_url":"https://api.github.com/users/mkurek/gists{/gist_id}","starred_url":"https://api.github.com/users/mkurek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkurek/subscriptions","organizations_url":"https://api.github.com/users/mkurek/orgs","repos_url":"https://api.github.com/users/mkurek/repos","events_url":"https://api.github.com/users/mkurek/events{/privacy}","received_events_url":"https://api.github.com/users/mkurek/received_events","type":"User","site_admin":false},"assignees":[{"login":"mkurek","id":107437,"avatar_url":"https://avatars.githubusercontent.com/u/107437?v=3","gravatar_id":"","url":"https://api.github.com/users/mkurek","html_url":"https://github.com/mkurek","followers_url":"https://api.github.com/users/mkurek/followers","following_url":"https://api.github.com/users/mkurek/following{/other_user}","gists_url":"https://api.github.com/users/mkurek/gists{/gist_id}","starred_url":"https://api.github.com/users/mkurek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkurek/subscriptions","organizations_url":"https://api.github.com/users/mkurek/orgs","repos_url":"https://api.github.com/users/mkurek/repos","events_url":"https://api.github.com/users/mkurek/events{/privacy}","received_events_url":"https://api.github.com/users/mkurek/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/allegro/ralph_pricing/pulls/530/commits","review_comments_url":"https://api.github.com/repos/allegro/ralph_pricing/pulls/530/comments","review_comment_url":"https://api.github.com/repos/allegro/ralph_pricing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/allegro/ralph_pricing/issues/530/comments","statuses_url":"https://api.github.com/repos/allegro/ralph_pricing/statuses/1a09ad1243e6d6279fd89a741d970cb0fe192212","head":{"label":"xor-xor:costs-panel","ref":"costs-panel","sha":"1a09ad1243e6d6279fd89a741d970cb0fe192212","user":{"login":"xor-xor","id":2082842,"avatar_url":"https://avatars.githubusercontent.com/u/2082842?v=3","gravatar_id":"","url":"https://api.github.com/users/xor-xor","html_url":"https://github.com/xor-xor","followers_url":"https://api.github.com/users/xor-xor/followers","following_url":"https://api.github.com/users/xor-xor/following{/other_user}","gists_url":"https://api.github.com/users/xor-xor/gists{/gist_id}","starred_url":"https://api.github.com/users/xor-xor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xor-xor/subscriptions","organizations_url":"https://api.github.com/users/xor-xor/orgs","repos_url":"https://api.github.com/users/xor-xor/repos","events_url":"https://api.github.com/users/xor-xor/events{/privacy}","received_events_url":"https://api.github.com/users/xor-xor/received_events","type":"User","site_admin":false},"repo":{"id":64742322,"name":"ralph_pricing","full_name":"xor-xor/ralph_pricing","owner":{"login":"xor-xor","id":2082842,"avatar_url":"https://avatars.githubusercontent.com/u/2082842?v=3","gravatar_id":"","url":"https://api.github.com/users/xor-xor","html_url":"https://github.com/xor-xor","followers_url":"https://api.github.com/users/xor-xor/followers","following_url":"https://api.github.com/users/xor-xor/following{/other_user}","gists_url":"https://api.github.com/users/xor-xor/gists{/gist_id}","starred_url":"https://api.github.com/users/xor-xor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xor-xor/subscriptions","organizations_url":"https://api.github.com/users/xor-xor/orgs","repos_url":"https://api.github.com/users/xor-xor/repos","events_url":"https://api.github.com/users/xor-xor/events{/privacy}","received_events_url":"https://api.github.com/users/xor-xor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xor-xor/ralph_pricing","description":"A pricing module for Ralph","fork":true,"url":"https://api.github.com/repos/xor-xor/ralph_pricing","forks_url":"https://api.github.com/repos/xor-xor/ralph_pricing/forks","keys_url":"https://api.github.com/repos/xor-xor/ralph_pricing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xor-xor/ralph_pricing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xor-xor/ralph_pricing/teams","hooks_url":"https://api.github.com/repos/xor-xor/ralph_pricing/hooks","issue_events_url":"https://api.github.com/repos/xor-xor/ralph_pricing/issues/events{/number}","events_url":"https://api.github.com/repos/xor-xor/ralph_pricing/events","assignees_url":"https://api.github.com/repos/xor-xor/ralph_pricing/assignees{/user}","branches_url":"https://api.github.com/repos/xor-xor/ralph_pricing/branches{/branch}","tags_url":"https://api.github.com/repos/xor-xor/ralph_pricing/tags","blobs_url":"https://api.github.com/repos/xor-xor/ralph_pricing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xor-xor/ralph_pricing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xor-xor/ralph_pricing/git/refs{/sha}","trees_url":"https://api.github.com/repos/xor-xor/ralph_pricing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xor-xor/ralph_pricing/statuses/{sha}","languages_url":"https://api.github.com/repos/xor-xor/ralph_pricing/languages","stargazers_url":"https://api.github.com/repos/xor-xor/ralph_pricing/stargazers","contributors_url":"https://api.github.com/repos/xor-xor/ralph_pricing/contributors","subscribers_url":"https://api.github.com/repos/xor-xor/ralph_pricing/subscribers","subscription_url":"https://api.github.com/repos/xor-xor/ralph_pricing/subscription","commits_url":"https://api.github.com/repos/xor-xor/ralph_pricing/commits{/sha}","git_commits_url":"https://api.github.com/repos/xor-xor/ralph_pricing/git/commits{/sha}","comments_url":"https://api.github.com/repos/xor-xor/ralph_pricing/comments{/number}","issue_comment_url":"https://api.github.com/repos/xor-xor/ralph_pricing/issues/comments{/number}","contents_url":"https://api.github.com/repos/xor-xor/ralph_pricing/contents/{+path}","compare_url":"https://api.github.com/repos/xor-xor/ralph_pricing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xor-xor/ralph_pricing/merges","archive_url":"https://api.github.com/repos/xor-xor/ralph_pricing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xor-xor/ralph_pricing/downloads","issues_url":"https://api.github.com/repos/xor-xor/ralph_pricing/issues{/number}","pulls_url":"https://api.github.com/repos/xor-xor/ralph_pricing/pulls{/number}","milestones_url":"https://api.github.com/repos/xor-xor/ralph_pricing/milestones{/number}","notifications_url":"https://api.github.com/repos/xor-xor/ralph_pricing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xor-xor/ralph_pricing/labels{/name}","releases_url":"https://api.github.com/repos/xor-xor/ralph_pricing/releases{/id}","deployments_url":"https://api.github.com/repos/xor-xor/ralph_pricing/deployments","created_at":"2016-08-02T09:12:33Z","updated_at":"2016-08-02T09:12:34Z","pushed_at":"2016-10-25T09:24:54Z","git_url":"git://github.com/xor-xor/ralph_pricing.git","ssh_url":"git@github.com:xor-xor/ralph_pricing.git","clone_url":"https://github.com/xor-xor/ralph_pricing.git","svn_url":"https://github.com/xor-xor/ralph_pricing","homepage":null,"size":5493,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"develop"}},"base":{"label":"allegro:develop","ref":"develop","sha":"a188967f9dc1d7e747cf1f219926c28499bf4f69","user":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"repo":{"id":9495095,"name":"ralph_pricing","full_name":"allegro/ralph_pricing","owner":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allegro/ralph_pricing","description":"A pricing module for Ralph","fork":false,"url":"https://api.github.com/repos/allegro/ralph_pricing","forks_url":"https://api.github.com/repos/allegro/ralph_pricing/forks","keys_url":"https://api.github.com/repos/allegro/ralph_pricing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allegro/ralph_pricing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allegro/ralph_pricing/teams","hooks_url":"https://api.github.com/repos/allegro/ralph_pricing/hooks","issue_events_url":"https://api.github.com/repos/allegro/ralph_pricing/issues/events{/number}","events_url":"https://api.github.com/repos/allegro/ralph_pricing/events","assignees_url":"https://api.github.com/repos/allegro/ralph_pricing/assignees{/user}","branches_url":"https://api.github.com/repos/allegro/ralph_pricing/branches{/branch}","tags_url":"https://api.github.com/repos/allegro/ralph_pricing/tags","blobs_url":"https://api.github.com/repos/allegro/ralph_pricing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allegro/ralph_pricing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allegro/ralph_pricing/git/refs{/sha}","trees_url":"https://api.github.com/repos/allegro/ralph_pricing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allegro/ralph_pricing/statuses/{sha}","languages_url":"https://api.github.com/repos/allegro/ralph_pricing/languages","stargazers_url":"https://api.github.com/repos/allegro/ralph_pricing/stargazers","contributors_url":"https://api.github.com/repos/allegro/ralph_pricing/contributors","subscribers_url":"https://api.github.com/repos/allegro/ralph_pricing/subscribers","subscription_url":"https://api.github.com/repos/allegro/ralph_pricing/subscription","commits_url":"https://api.github.com/repos/allegro/ralph_pricing/commits{/sha}","git_commits_url":"https://api.github.com/repos/allegro/ralph_pricing/git/commits{/sha}","comments_url":"https://api.github.com/repos/allegro/ralph_pricing/comments{/number}","issue_comment_url":"https://api.github.com/repos/allegro/ralph_pricing/issues/comments{/number}","contents_url":"https://api.github.com/repos/allegro/ralph_pricing/contents/{+path}","compare_url":"https://api.github.com/repos/allegro/ralph_pricing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allegro/ralph_pricing/merges","archive_url":"https://api.github.com/repos/allegro/ralph_pricing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allegro/ralph_pricing/downloads","issues_url":"https://api.github.com/repos/allegro/ralph_pricing/issues{/number}","pulls_url":"https://api.github.com/repos/allegro/ralph_pricing/pulls{/number}","milestones_url":"https://api.github.com/repos/allegro/ralph_pricing/milestones{/number}","notifications_url":"https://api.github.com/repos/allegro/ralph_pricing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allegro/ralph_pricing/labels{/name}","releases_url":"https://api.github.com/repos/allegro/ralph_pricing/releases{/id}","deployments_url":"https://api.github.com/repos/allegro/ralph_pricing/deployments","created_at":"2013-04-17T10:30:06Z","updated_at":"2016-05-06T19:28:53Z","pushed_at":"2016-10-25T09:25:59Z","git_url":"git://github.com/allegro/ralph_pricing.git","ssh_url":"git@github.com:allegro/ralph_pricing.git","clone_url":"https://github.com/allegro/ralph_pricing.git","svn_url":"https://github.com/allegro/ralph_pricing","homepage":null,"size":6605,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":12,"forks":17,"open_issues":12,"watchers":7,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/allegro/ralph_pricing/pulls/530"},"html":{"href":"https://github.com/allegro/ralph_pricing/pull/530"},"issue":{"href":"https://api.github.com/repos/allegro/ralph_pricing/issues/530"},"comments":{"href":"https://api.github.com/repos/allegro/ralph_pricing/issues/530/comments"},"review_comments":{"href":"https://api.github.com/repos/allegro/ralph_pricing/pulls/530/comments"},"review_comment":{"href":"https://api.github.com/repos/allegro/ralph_pricing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/allegro/ralph_pricing/pulls/530/commits"},"statuses":{"href":"https://api.github.com/repos/allegro/ralph_pricing/statuses/1a09ad1243e6d6279fd89a741d970cb0fe192212"}}}}
{"actor":{"display_login":"xor-xor"}}