8000 Post rebasing fixes · senthgit/twilio-java@908e34b · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 908e34b

Browse files
AlexPaymentskimbrel
authored andcommitted
Post rebasing fixes
1 parent 118fb0e commit 908e34b

File tree

5 files changed

+49
-64
lines changed

5 files changed

+49
-64
lines changed

src/main/java/com/twilio/sdk/resource/instance/Address.java

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*
3131
* For more information see <a href="https://www.twilio.com/docs/api/rest/address">https://www.twilio.com/docs/api/rest/address</a>
3232
*/
33-
public class Address extends InstanceResource {
33+
public class Address extends InstanceResource<TwilioRestClient> {
3434

3535
/** The Constant SID_PROPERTY. */
3636
private static final String SID_PROPERTY = "sid";
@@ -41,12 +41,12 @@ public class Address extends InstanceResource {
4141
* @param client the client
4242
* @param sid the sid
4343
*/
44-
public Address(TwilioRestClient client, String sid) {
44+
public Address(final TwilioRestClient client, final String sid) {
4545
super(client);
4646
if (sid == null) {
4747
throw new IllegalStateException("The Sid for an Address cannot be null");
4848
}
49-
this.setProperty(SID_PROPERTY, sid);
49+
setProperty(SID_PROPERTY, sid);
5050
}
5151

5252
/**
@@ -55,7 +55,7 @@ public Address(TwilioRestClient client, String sid) {
5555
* @param client the client
5656
* @param properties the properties
5757
*/
58-
public Address(TwilioRestClient client, Map<String, Object> properties) {
58+
public Address(final TwilioRestClient client, final Map<String, Object> properties) {
5959
super(client, properties);
6060
}
6161

@@ -65,7 +65,7 @@ public Address(TwilioRestClient client, Map<String, Object> properties) {
6565
@Override
6666
protected String getResourceLocation() {
6767
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
68-
+ this.getRequestAccountSid() + "/Addresses/" + this.getSid() + ".json";
68+
+ getRequestAccountSid() + "/Addresses/" + getSid() + ".json";
6969
}
7070

7171
/*
@@ -77,7 +77,7 @@ protected String getResourceLocation() {
7777
* @return the sid
7878
*/
7979
public String getSid() {
80-
return this.getProperty(SID_PROPERTY);
80+
return getProperty(SID_PROPERTY);
8181
}
8282

8383
/**
@@ -89,8 +89,8 @@ public Date getDateCreated() {
8989
SimpleDateFormat format = new SimpleDateFormat(
9090
"EEE, dd MMM yyyy HH:mm:ss Z");
9191
try {
92-
return format.parse(this.getProperty("date_created"));
93-
} catch (ParseException e) {
92+
return format.parse(getProperty("date_created"));
93+
} catch (final ParseException e) {
9494
return null;
9595
}
9696
}
@@ -104,8 +104,8 @@ public Date getDateUpdated() {
104104
SimpleDateFormat format = new SimpleDateFormat(
105105
"EEE, dd MMM yyyy HH:mm:ss Z");
106106
try {
107-
return format.parse(this.getProperty("date_updated"));
108-
} catch (ParseException e) {
107+
return format.parse(getProperty("date_updated"));
108+
} catch (final ParseException e) {
109109
return null;
110110
}
111111
}
@@ -116,7 +116,7 @@ public Date getDateUpdated() {
116116
* @return the account sid
117117
*/
118118
public String getAccountSid() {
119-
return this.getProperty("account_sid");
119+
return getProperty("account_sid");
120120
}
121121

122122
/**
@@ -125,7 +125,7 @@ public String getAccountSid() {
125125
* @return the friendly name
126126
*/
127127
public String getFriendlyName() {
128-
return this.getProperty("friendly_name");
128+
return getProperty("friendly_name");
129129
}
130130

131131
/**
@@ -134,7 +134,7 @@ public String getFriendlyName() {
134134
* @return the customer name
135135
*/
136136
public String getCustomerName() {
137-
return this.getProperty("customer_name");
137+
return getProperty("customer_name");
138138
}
139139

140140
/**
@@ -143,7 +143,7 @@ public String getCustomerName() {
143143
* @return the street number
144144
*/
145145
public String getStreet() {
146-
return this.getProperty("street");
146+
return getProperty("street");
147147
}
148148

149149
/**
@@ -152,7 +152,7 @@ public String getStreet() {
152152
* @return the city
153153
*/
154154
public String getCity() {
155-
return this.getProperty("city");
155+
return getProperty("city");
156156
}
157157

158158
/**
@@ -161,7 +161,7 @@ public String getCity() {
161161
* @return the region
162162
*/
163163
public String getRegion() {
164-
return this.getProperty("region");
164+
return getProperty("region");
165165
}
166166

167167
/**
@@ -170,7 +170,7 @@ public String getRegion() {
170170
* @return the postal code
171171
*/
172172
public String getPostalCode() {
173-
return this.getProperty("postal_code");
173+
return getProperty("postal_code");
174174
}
175175

176176
/**
@@ -179,7 +179,7 @@ public String getPostalCode() {
179179
* @return the country code
180180
*/
181181
public String getIsoCountry() {
182-
return this.getProperty("iso_country");
182+
return getProperty("iso_country");
183183
}
184184

185185
/**
@@ -190,14 +190,13 @@ public String getIsoCountry() {
190190
*
191191
*/
192192
public DependentPhoneNumberList getDependentPhoneNumbers() {
193-
DependentPhoneNumberList list = new DependentPhoneNumberList(this.getClient(), this.getSid());
194-
list.setRequestAccountSid(this.getRequestAccountSid());
193+
DependentPhoneNumberList list = new DependentPhoneNumberList(getClient(), getSid());
194+
list.setRequestAccountSid(getRequestAccountSid());
195195
return list;
196196
}
197197

198198
public boolean delete() throws TwilioRestException {
199-
TwilioRestResponse response = this.getClient().safeRequest(
200-
this.getResourceLocation(), "DELETE", (Map) null);
199+
TwilioRestResponse response = getClient().safeRequest(getResourceLocation(), "DELETE", (Map) null);
201200

202201
return !response.isError();
203202
}

src/main/java/com/twilio/sdk/resource/list/AddressList.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
*
1818
* For more information see <a href="https://www.twilio.com/docs/api/rest/address">https://www.twilio.com/docs/api/rest/address</a>
1919
*/
20-
public class AddressList extends ListResource<Address> implements AddressFactory {
20+
public class AddressList extends ListResource<Address, TwilioRestClient> implements AddressFactory {
2121

2222
/**
2323
* Instantiates a new address list.
2424
*
2525
* @param client the client
2626
*/
27-
public AddressList(TwilioRestClient client) {
27+
public AddressList(final TwilioRestClient client) {
2828
super(client);
2929
}
3030

@@ -34,7 +34,7 @@ public AddressList(TwilioRestClient client) {
3434
* @param client the client
3535
* @param filters the filters
3636
*/
37-
public AddressList(TwilioRestClient client, Map<String, String> filters) {
37+
public AddressList(final TwilioRestClient client, final Map<String, String> filters) {
3838
super(client, filters);
3939
}
4040

@@ -44,15 +44,15 @@ public AddressList(TwilioRestClient client, Map<String, String> filters) {
4444
@Override
4545
protected String getResourceLocation() {
4646
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
47-
+ this.getRequestAccountSid() + "/Addresses.json";
47+
+ getRequestAccountSid() + "/Addresses.json";
4848
}
4949

5050
/* (non-Javadoc)
5151
* @see com.twilio.sdk.resource.ListResource#makeNew(com.twilio.sdk.TwilioRestClient, java.util.Map)
5252
*/
5353
@Override
54-
protected Address makeNew(TwilioRestClient client,
55-
Map<String, Object> params) {
54+
protected Address makeNew(final TwilioRestClient client,
55+
final Map<String, Object> params) {
5656
return new Address(client, params);
5757
}
5858

@@ -64,17 +64,15 @@ protected String getListKey() {
6464
return "addresses";
6565
}
6666

67-
public Address create(Map<String, String> params) throws TwilioRestException {
68-
TwilioRestResponse response = this.getClient().safeRequest(
69-
this.getResourceLocation(), "POST", params);
70-
return makeNew(this.getClient(), response.toMap());
67+
public Address create(final Map<String, String> params) throws TwilioRestException {
68+
TwilioRestResponse response = getClient().safeRequest(getResourceLocation(), "POST", params);
69+
return makeNew(getClient(), response.toMap());
7170
}
7271

73-
public Address create(List<NameValuePair> params) throws TwilioRestException {
74-
TwilioRestResponse response = this.getClient().safeRequest(
75-
this.getResourceLocation(), "POST", params
72+
public Address create(final List<NameValuePair> params) throws TwilioRestException {
73+
TwilioRestResponse response = getClient().safeRequest(getResourceLocation(), "POST", params
7674
);
77-
return makeNew(this.getClient(), response.toMap());
75+
return makeNew(getClient(), response.toMap());
7876
}
7977

8078

src/main/java/com/twilio/sdk/resource/list/DependentPhoneNumberList.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* For more information see <a href="https://www.twilio.com/docs/api/rest/address">https://www.twilio.com/docs/api/rest/address</a>
1818
*/
19-
public class DependentPhoneNumberList extends ListResource<DependentPhoneNumber> {
19+
public class DependentPhoneNumberList extends ListResource<DependentPhoneNumber, TwilioRestClient> {
2020

2121
private String addressSid;
2222

@@ -25,11 +25,11 @@ public class DependentPhoneNumberList extends ListResource<DependentPhoneNumber>
2525
*
2626
* @param client the client
2727
*/
28-
public DependentPhoneNumberList(TwilioRestClient client) {
28+
public DependentPhoneNumberList(final TwilioRestClient client) {
2929
super(client);
3030
}
3131

32-
public DependentPhoneNumberList(TwilioRestClient client, String addressSid) {
32+
public DependentPhoneNumberList(final TwilioRestClient client, final String addressSid) {
3333
super(client);
3434
this.addressSid = addressSid;
3535
}
@@ -40,7 +40,7 @@ public DependentPhoneNumberList(TwilioRestClient client, String addressSid) {
4040
* @param client the client
4141
* @param filters the filters
4242
*/
43-
public DependentPhoneNumberList(TwilioRestClient client, Map<String, String> filters) {
43+
public DependentPhoneNumberList(final TwilioRestClient client, final Map<String, String> filters) {
4444
super(client, filters);
4545
}
4646

@@ -50,7 +50,7 @@ public DependentPhoneNumberList(TwilioRestClient client, Map<String, String> fil
5050
@Override
5151
protected String getResourceLocation() {
5252
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
53-
+ this.getRequestAccountSid() + "/Conferences.json";
53+
+ getRequestAccountSid() + "/Conferences.json";
5454
}
5555

5656
/* (non-Javadoc)
@@ -65,7 +65,7 @@ protected String getListKey() {
6565
* @see com.twilio.sdk.resource.ListResource#makeNew(com.twilio.sdk.TwilioRestClient, java.util.Map)
6666
*/
6767
@Override
68-
protected DependentPhoneNumber makeNew(TwilioRestClient client, Map<String, Object> properties) {
68+
protected DependentPhoneNumber makeNew(final TwilioRestClient client, final Map<String, Object> properties) {
6969
return new DependentPhoneNumber(client, properties);
7070
}
7171

src/main/java/com/twilio/sdk/resource/list/TokenList.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
*
1818
* For more information see <a href="https://www.twilio.com/docs/api/rest/token">https://www.twilio.com/docs/api/rest/token</a>
1919
*/
20-
public class TokenList extends ListResource<Token> implements TokenFactory {
20+
public class TokenList extends ListResource<Token, TwilioRestClient> implements TokenFactory {
2121

2222
/**
2323
* Instantiates a new Token list.
2424
*
2525
* @param client the client
2626
*/
27-
public TokenList(TwilioRestClient client) {
27+
public TokenList(final TwilioRestClient client) {
2828
super(client);
2929
}
3030

@@ -34,7 +34,7 @@ public TokenList(TwilioRestClient client) {
3434
* @param client the client
3535
* @param filters the filters
3636
*/
37-
public TokenList(TwilioRestClient client, Map<String, String> filters) {
37+
public TokenList(final TwilioRestClient client, final Map<String, String> filters) {
3838
super(client, filters);
3939
}
4040

@@ -44,14 +44,14 @@ public TokenList(TwilioRestClient client, Map<String, String> filters) {
4444
@Override
4545
protected String getResourceLocation() {
4646
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
47-
+ this.getRequestAccountSid() + "/Tokens.json";
47+
+ getRequestAccountSid() + "/Tokens.json";
4848
}
4949

5050
/* (non-Javadoc)
5151
* @see com.twilio.sdk.resource.ListResource#makeNew(com.twilio.sdk.TwilioRestClient, java.util.Map)
5252
*/
5353
@Override
54-
protected Token makeNew(TwilioRestClient client, Map<String, Object> params) {
54+
protected Token makeNew(final TwilioRestClient client, final Map<String, Object> params) {
5555
return new Token(client, params);
5656
}
5757

@@ -63,9 +63,8 @@ protected String getListKey() {
6363
/* (non-Javadoc)
6464
* @see com.twilio.sdk.resource.factory.TokenFactory#create(java.util.Map)
6565
*/
66-
public Token create(List<NameValuePair> params) throws TwilioRestException {
67-
TwilioRestResponse response = this.getClient().safeRequest(
68-
this.getResourceLocation(), "POST", params);
69-
return makeNew(this.getClient(), response.toMap());
66+
public Token create(final List<NameValuePair> params) throws TwilioRestException {
67+
TwilioRestResponse response = getClient().safeRequest(getResourceLocation(), "POST", params);
68+
return makeNew(getClient(), response.toMap());
7069
}
7170
}

src/test/java/com/twilio/sdk/resource/instance/TokenTest.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
11
package com.twilio.sdk.resource.instance;
22

3-
import com.twilio.sdk.TwilioRestClient;
43
import com.twilio.sdk.TwilioRestException;
5-
import com.twilio.sdk.TwilioRestResponse;
6-
import com.twilio.sdk.resource.list.TokenList;
7-
import com.twilio.sdk.resource.instance.Token;
8-
94
import org.apache.http.NameValuePair;
10-
11-
import org.junit.Test;
125
import org.junit.Before;
6+
import org.junit.Test;
137
import org.mockito.Mock;
148

159
import java.util.ArrayList;
16-
import java.util.HashMap;
1710
import java.util.List;
18-
import java.util.Map;
19-
2011

2112
import static org.junit.Assert.assertEquals;
2213
import static org.junit.Assert.assertTrue;
23-
import static org.mockito.Mockito.mock;
24-
import static org.mockito.Mockito.stub;
2514

2615
public class TokenTest extends BasicRequestTester {
2716

@@ -34,7 +23,7 @@ public class TokenTest extends BasicRequestTester {
3423
public void setup() throws Exception {
3524
setExpectedServerContentType("application/json");
3625
setExpectedServerAnswer("token.json");
37-
token = client.getAccount().getTokenFactory().create(new ArrayList<NameValuePair>());
26+
token = restClient.getAccount().getTokenFactory().create(new ArrayList<NameValuePair>());
3827
}
3928

4029
@Test

0 commit comments

Comments
 (0)
0