Added more fields and license headers.
This commit is contained in:
parent
f17262c851
commit
52f569cf68
|
@ -3,13 +3,14 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
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: "java"
|
||||
apply plugin: "groovy"
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
id = libcvrapi
|
||||
group = biz.nellemann.libs
|
||||
version = 1.0.0
|
||||
version = 1.0.1
|
||||
licenses = ['APACHE-2.0'] // or something else
|
||||
groovyVersion = 2.5.8
|
||||
slf4jVersion = 1.7.25
|
||||
|
|
|
@ -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;
|
||||
|
||||
public class Address {
|
||||
|
|
29
src/main/java/biz/nellemann/libcvrapi/Capital.java
Normal file
29
src/main/java/biz/nellemann/libcvrapi/Capital.java
Normal 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;
|
||||
|
||||
}
|
|
@ -1,16 +1,27 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
* 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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mark
|
||||
*/
|
||||
public class Company {
|
||||
|
||||
BigDecimal vat;
|
||||
|
@ -19,10 +30,23 @@ public class Company {
|
|||
Address address;
|
||||
Contact contact;
|
||||
Industrycode industrycode;
|
||||
Companyform compantform;
|
||||
Companystatus companystatus;
|
||||
Status status;
|
||||
|
||||
// companyform
|
||||
// companystatus
|
||||
// contact
|
||||
// industrycode
|
||||
// Accounting accounting;
|
||||
// Tax tax;
|
||||
|
||||
Capital capital;
|
||||
Shareholder shareholder;
|
||||
Info info;
|
||||
|
||||
ArrayList<String> secondarynames;
|
||||
|
||||
// Ejerkredsen
|
||||
// List<Participant> participants
|
||||
|
||||
// Ejerskab over andre selskaber
|
||||
// List<Participation> participations
|
||||
|
||||
}
|
||||
|
|
28
src/main/java/biz/nellemann/libcvrapi/Companyform.java
Normal file
28
src/main/java/biz/nellemann/libcvrapi/Companyform.java
Normal 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;
|
||||
}
|
27
src/main/java/biz/nellemann/libcvrapi/Companystatus.java
Normal file
27
src/main/java/biz/nellemann/libcvrapi/Companystatus.java
Normal 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;
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
||||
public class Contact {
|
||||
|
|
|
@ -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;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Credentials;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.Credentials;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
|
||||
public class CvrApi {
|
||||
|
||||
|
@ -22,27 +39,21 @@ public class CvrApi {
|
|||
private final String userAgent;
|
||||
private final String authenticationToken;
|
||||
|
||||
|
||||
public CvrApi(String userAgent, String authenticationToken) {
|
||||
this.userAgent = userAgent;
|
||||
this.authenticationToken = authenticationToken;
|
||||
client = new OkHttpClient();
|
||||
}
|
||||
|
||||
|
||||
private String get(String url) throws IOException, Exception {
|
||||
|
||||
String credential = Credentials.basic(authenticationToken, "");
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.header("User-Agent", userAgent)
|
||||
.header("Authorization", credential)
|
||||
.addHeader("Accept", "application/json;")
|
||||
.build();
|
||||
Request request = new Request.Builder().url(url).header("User-Agent", userAgent)
|
||||
.header("Authorization", credential).addHeader("Accept", "application/json;").build();
|
||||
|
||||
Response response = client.newCall(request).execute();
|
||||
switch(response.code()) {
|
||||
switch (response.code()) {
|
||||
case 200:
|
||||
return response.body().string();
|
||||
case 401:
|
||||
|
@ -53,7 +64,6 @@ public class CvrApi {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* https://rest.cvrapi.dk/v1/dk/company/vatNumber
|
||||
*
|
||||
|
@ -62,11 +72,10 @@ public class CvrApi {
|
|||
* @throws IOException
|
||||
*/
|
||||
protected String getCompanyJson(String vatNumber) throws IOException, Exception {
|
||||
String response = get("https://rest.cvrapi.dk/v1/dk/company/"+vatNumber);
|
||||
String response = get("https://rest.cvrapi.dk/v1/dk/company/" + vatNumber);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use GSON to deserialize JSON into objects.
|
||||
*
|
||||
|
@ -86,7 +95,6 @@ public class CvrApi {
|
|||
return company;
|
||||
}
|
||||
|
||||
|
||||
public Company getCompanyByVatNumber(String vatNumber) {
|
||||
|
||||
try {
|
||||
|
|
|
@ -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;
|
||||
|
||||
public class Industrycode {
|
||||
|
|
35
src/main/java/biz/nellemann/libcvrapi/Info.java
Normal file
35
src/main/java/biz/nellemann/libcvrapi/Info.java
Normal 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" }
|
||||
*/
|
||||
}
|
|
@ -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;
|
||||
|
||||
public class Life {
|
||||
|
|
27
src/main/java/biz/nellemann/libcvrapi/Shareholder.java
Normal file
27
src/main/java/biz/nellemann/libcvrapi/Shareholder.java
Normal 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;
|
||||
|
||||
}
|
30
src/main/java/biz/nellemann/libcvrapi/Status.java
Normal file
30
src/main/java/biz/nellemann/libcvrapi/Status.java
Normal 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;
|
||||
|
||||
}
|
|
@ -25,6 +25,7 @@ class CvrApiSpec extends Specification {
|
|||
company != null
|
||||
company.vat == 25063864
|
||||
company.life.name == 'AGILLIC A/S'
|
||||
company.secondarynames.contains('Wavetech A/S')
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue