Added more fields and license headers.

This commit is contained in:
Mark Nellemann 2019-08-19 10:00:01 +02:00
parent f17262c851
commit 52f569cf68
16 changed files with 3187 additions and 49 deletions

View file

@ -3,13 +3,14 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
} }
} }
apply plugin: "idea" apply plugin: "idea"
apply plugin: "java" apply plugin: "java"
apply plugin: "groovy" apply plugin: "groovy"
apply plugin: 'maven'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray' apply plugin: 'com.jfrog.bintray'

View file

@ -1,6 +1,6 @@
id = libcvrapi id = libcvrapi
group = biz.nellemann.libs group = biz.nellemann.libs
version = 1.0.0 version = 1.0.1
licenses = ['APACHE-2.0'] // or something else licenses = ['APACHE-2.0'] // or something else
groovyVersion = 2.5.8 groovyVersion = 2.5.8
slf4jVersion = 1.7.25 slf4jVersion = 1.7.25

View file

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package biz.nellemann.libcvrapi; package biz.nellemann.libcvrapi;
public class Address { public class Address {

View file

@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package biz.nellemann.libcvrapi;
public class Capital {
String capital;
String currency;
Boolean partial;
Boolean ipo;
}

View file

@ -1,16 +1,27 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Licensed to the Apache Software Foundation (ASF) under one
* To change this template file, choose Tools | Templates * or more contributor license agreements. See the NOTICE file
* and open the template in the editor. * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package biz.nellemann.libcvrapi; package biz.nellemann.libcvrapi;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
/**
*
* @author mark
*/
public class Company { public class Company {
BigDecimal vat; BigDecimal vat;
@ -19,10 +30,23 @@ public class Company {
Address address; Address address;
Contact contact; Contact contact;
Industrycode industrycode; Industrycode industrycode;
Companyform compantform;
Companystatus companystatus;
Status status;
// companyform // Accounting accounting;
// companystatus // Tax tax;
// contact
// industrycode Capital capital;
Shareholder shareholder;
Info info;
ArrayList<String> secondarynames;
// Ejerkredsen
// List<Participant> participants
// Ejerskab over andre selskaber
// List<Participation> participations
} }

View file

@ -0,0 +1,28 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package biz.nellemann.libcvrapi;
public class Companyform {
String code;
String description;
String longdescription;
Boolean holding;
}

View file

@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package biz.nellemann.libcvrapi;
public class Companystatus {
String text;
String start;
}

View file

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package biz.nellemann.libcvrapi; package biz.nellemann.libcvrapi;
public class Contact { public class Contact {

View file

@ -1,18 +1,35 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package biz.nellemann.libcvrapi; package biz.nellemann.libcvrapi;
import java.io.IOException;
import com.google.gson.Gson;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.IOException;
import okhttp3.Credentials;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.Response; import okhttp3.Response;
import okhttp3.Credentials;
import com.google.gson.Gson;
public class CvrApi { public class CvrApi {
@ -22,24 +39,18 @@ public class CvrApi {
private final String userAgent; private final String userAgent;
private final String authenticationToken; private final String authenticationToken;
public CvrApi(String userAgent, String authenticationToken) { public CvrApi(String userAgent, String authenticationToken) {
this.userAgent = userAgent; this.userAgent = userAgent;
this.authenticationToken = authenticationToken; this.authenticationToken = authenticationToken;
client = new OkHttpClient(); client = new OkHttpClient();
} }
private String get(String url) throws IOException, Exception { private String get(String url) throws IOException, Exception {
String credential = Credentials.basic(authenticationToken, ""); String credential = Credentials.basic(authenticationToken, "");
Request request = new Request.Builder() Request request = new Request.Builder().url(url).header("User-Agent", userAgent)
.url(url) .header("Authorization", credential).addHeader("Accept", "application/json;").build();
.header("User-Agent", userAgent)
.header("Authorization", credential)
.addHeader("Accept", "application/json;")
.build();
Response response = client.newCall(request).execute(); Response response = client.newCall(request).execute();
switch (response.code()) { switch (response.code()) {
@ -53,7 +64,6 @@ public class CvrApi {
} }
/** /**
* https://rest.cvrapi.dk/v1/dk/company/vatNumber * https://rest.cvrapi.dk/v1/dk/company/vatNumber
* *
@ -66,7 +76,6 @@ public class CvrApi {
return response; return response;
} }
/** /**
* Use GSON to deserialize JSON into objects. * Use GSON to deserialize JSON into objects.
* *
@ -86,7 +95,6 @@ public class CvrApi {
return company; return company;
} }
public Company getCompanyByVatNumber(String vatNumber) { public Company getCompanyByVatNumber(String vatNumber) {
try { try {

View file

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package biz.nellemann.libcvrapi; package biz.nellemann.libcvrapi;
public class Industrycode { public class Industrycode {

View file

@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package biz.nellemann.libcvrapi;
public class Info {
String articles_of_association;
String purpose;
String bind;
/*
* "modes": { "legislation_money_laundering": false, "social_economic": false,
* "government": false }, "attributes": {
* "management_recognized_as_beneficial_owners": true }, "demerges": null,
* "merges": null, "lei": { "id": "894500WP4D8JDZ88S128" }, "employment": {
* "intervalAmountEmployees": "ANTAL_50_99", "amountEmployeesLow": "50",
* "amountEmployeesHigh": "99", "year": "2019", "month": "2" }
*/
}

View file

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package biz.nellemann.libcvrapi; package biz.nellemann.libcvrapi;
public class Life { public class Life {

View file

@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package biz.nellemann.libcvrapi;
public class Shareholder {
Boolean below_5_percent;
Boolean isPublic;
}

View file

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package biz.nellemann.libcvrapi;
public class Status {
String code;
String creditcode;
String start;
String end;
Boolean bankrupt;
}

View file

@ -25,6 +25,7 @@ class CvrApiSpec extends Specification {
company != null company != null
company.vat == 25063864 company.vat == 25063864
company.life.name == 'AGILLIC A/S' company.life.name == 'AGILLIC A/S'
company.secondarynames.contains('Wavetech A/S')
} }
} }

File diff suppressed because one or more lines are too long