Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO] Licensing API #15136

Merged
merged 9 commits into from
Oct 14, 2019
Merged

[DO] Licensing API #15136

merged 9 commits into from
Oct 14, 2019

Conversation

gonzaloriestra
Copy link
Contributor

@gonzaloriestra gonzaloriestra commented Oct 11, 2019

Related to https://github.com/CartoDB/data-observatory/issues/144, https://github.com/CartoDB/data-observatory/issues/212, CartoDB/cartoframes#1079

  • Renamed /do/datasets to /do/subscriptions
  • Added GET /do/subscription_info to get metadata from a dataset
  • Added POST /do/subscriptions to enable a subscription in case of delivery time = 0 (in another case we should send an email, but we do nothing for now)
  • Refactored licensing logic to a service (used now from the data_observatory.rake and the new POST endpoint)
  • The new endpoints require the feature flag do-licensing

GET /do/subscriptions

Params

  • type: 'dataset' / 'geography' (optional)
  • order: 'project' / 'dataset' / 'table' / 'id' / 'type' (optional)
  • order_direction: 'asc' / 'desc' (optional)

Response

{
 "subscriptions": [
   {
     "project": "carto",
     "dataset": "bbva",
     "table": "financial_spain_2019",
     "id": "carto.bbva.financial_spain_2019",
     "type": "dataset"
   },
   ...
 ]
}

GET /do/subscription_info

Params

  • id: string
  • type: 'dataset' / 'geography'

Response

   {
     "id": "",
     "estimated_delivery_days": 0,
     "subscription_list_price": 0,
     "tos": "",
     "tos_link": "",
     "licenses": "",
     "licenses_link": "",
     "rights": "",
     "type": ""
   }

POST /do/subscriptions

Params

  • id: string
  • type: 'dataset' / 'geography'

Response

   {
     "id": "",
     "estimated_delivery_days": 0,
     "subscription_list_price": 0,
     "tos": "",
     "tos_link": "",
     "licenses": "",
     "licenses_link": "",
     "rights": "",
     "type": ""
   }

Copy link
Contributor

@alrocar alrocar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a minor. Quite comprehensive tests ❤️

I think we can move to acceptance (once we fix the tests)

@gonzaloriestra gonzaloriestra removed their assignment Oct 11, 2019
@gonzaloriestra
Copy link
Contributor Author

retest this please

@simon-contreras-deel simon-contreras-deel self-assigned this Oct 11, 2019
@alrocar
Copy link
Contributor

alrocar commented Oct 13, 2019

Acceptance 🍏

  • It does not work without feature flag
  • It does not work without service account set up in central
  • Returns dataset and geography subscription info
  • It licenses a dataset if delivery time == 0 and creates the view
  • It "licenses" a dataset if delivery time > 0 and does not create the view
  • It lists the licensed datasets

We actually need to send the e-mail (we need it to gather metrics). I'm adding a separate issue for that.

@gonzaloriestra gonzaloriestra merged commit e3a55de into master Oct 14, 2019
@gonzaloriestra gonzaloriestra deleted the do-subscriptions branch October 14, 2019 06:30
@simon-contreras-deel simon-contreras-deel removed their assignment Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants