• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-java / #16371

29 Aug 2024 10:04PM UTC coverage: 16.372% (-0.008%) from 16.38%
#16371

Pull #1856

github

web-flow
Merge aebf629ab into a6080c2d9
Pull Request #1856: Generate SDK for OpenAPI spec version 1230

5 of 80 new or added lines in 14 files covered. (6.25%)

9 existing lines in 9 files now uncovered.

18152 of 110870 relevant lines covered (16.37%)

0.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.63
/src/main/java/com/stripe/model/testhelpers/TestClock.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model.testhelpers;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.model.HasId;
7
import com.stripe.model.StripeObject;
8
import com.stripe.net.ApiMode;
9
import com.stripe.net.ApiRequest;
10
import com.stripe.net.ApiRequestParams;
11
import com.stripe.net.ApiResource;
12
import com.stripe.net.BaseAddress;
13
import com.stripe.net.RequestOptions;
14
import com.stripe.net.StripeResponseGetter;
15
import com.stripe.param.testhelpers.TestClockAdvanceParams;
16
import com.stripe.param.testhelpers.TestClockCreateParams;
17
import com.stripe.param.testhelpers.TestClockListParams;
18
import com.stripe.param.testhelpers.TestClockRetrieveParams;
19
import java.util.Map;
20
import lombok.EqualsAndHashCode;
21
import lombok.Getter;
22
import lombok.Setter;
23

24
/**
25
 * A test clock enables deterministic control over objects in testmode. With a test clock, you can
26
 * create objects at a frozen time in the past or future, and advance to a specific future time to
27
 * observe webhooks and state changes. After the clock advances, you can either validate the current
28
 * state of your scenario (and test your assumptions), change the current state of your scenario
29
 * (and test more complex scenarios), or keep advancing forward in time.
30
 */
31
@Getter
32
@Setter
33
@EqualsAndHashCode(callSuper = false)
34
public class TestClock extends ApiResource implements HasId {
1✔
35
  /** Time at which the object was created. Measured in seconds since the Unix epoch. */
36
  @SerializedName("created")
37
  Long created;
38

39
  /** Always true for a deleted object. */
40
  @SerializedName("deleted")
41
  Boolean deleted;
42

43
  /** Time at which this clock is scheduled to auto delete. */
44
  @SerializedName("deletes_after")
45
  Long deletesAfter;
46

47
  /** Time at which all objects belonging to this clock are frozen. */
48
  @SerializedName("frozen_time")
49
  Long frozenTime;
50

51
  /** Unique identifier for the object. */
52
  @Getter(onMethod_ = {@Override})
53
  @SerializedName("id")
54
  String id;
55

56
  /**
57
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
58
   * object exists in test mode.
59
   */
60
  @SerializedName("livemode")
61
  Boolean livemode;
62

63
  /** The custom name supplied at creation. */
64
  @SerializedName("name")
65
  String name;
66

67
  /**
68
   * String representing the object's type. Objects of the same type share the same value.
69
   *
70
   * <p>Equal to {@code test_helpers.test_clock}.
71
   */
72
  @SerializedName("object")
73
  String object;
74

75
  /**
76
   * The status of the Test Clock.
77
   *
78
   * <p>One of {@code advancing}, {@code internal_failure}, or {@code ready}.
79
   */
80
  @SerializedName("status")
81
  String status;
82

83
  @SerializedName("status_details")
84
  StatusDetails statusDetails;
85

86
  /**
87
   * Starts advancing a test clock to a specified time in the future. Advancement is done when
88
   * status changes to {@code Ready}.
89
   */
90
  public TestClock advance(Map<String, Object> params) throws StripeException {
91
    return advance(params, (RequestOptions) null);
×
92
  }
93

94
  /**
95
   * Starts advancing a test clock to a specified time in the future. Advancement is done when
96
   * status changes to {@code Ready}.
97
   */
98
  public TestClock advance(Map<String, Object> params, RequestOptions options)
99
      throws StripeException {
100
    String path =
×
101
        String.format(
×
102
            "/v1/test_helpers/test_clocks/%s/advance", ApiResource.urlEncodeId(this.getId()));
×
103
    ApiRequest request =
×
104
        new ApiRequest(
105
            BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options, ApiMode.V1);
106
    return getResponseGetter().request(request, TestClock.class);
×
107
  }
108

109
  /**
110
   * Starts advancing a test clock to a specified time in the future. Advancement is done when
111
   * status changes to {@code Ready}.
112
   */
113
  public TestClock advance(TestClockAdvanceParams params) throws StripeException {
114
    return advance(params, (RequestOptions) null);
1✔
115
  }
116

117
  /**
118
   * Starts advancing a test clock to a specified time in the future. Advancement is done when
119
   * status changes to {@code Ready}.
120
   */
121
  public TestClock advance(TestClockAdvanceParams params, RequestOptions options)
122
      throws StripeException {
123
    String path =
1✔
124
        String.format(
1✔
125
            "/v1/test_helpers/test_clocks/%s/advance", ApiResource.urlEncodeId(this.getId()));
1✔
126
    ApiResource.checkNullTypedParams(path, params);
1✔
127
    ApiRequest request =
1✔
128
        new ApiRequest(
129
            BaseAddress.API,
130
            ApiResource.RequestMethod.POST,
131
            path,
132
            ApiRequestParams.paramsToMap(params),
1✔
133
            options,
134
            ApiMode.V1);
135
    return getResponseGetter().request(request, TestClock.class);
1✔
136
  }
137

138
  /** Creates a new test clock that can be attached to new customers and quotes. */
139
  public static TestClock create(Map<String, Object> params) throws StripeException {
140
    return create(params, (RequestOptions) null);
×
141
  }
142

143
  /** Creates a new test clock that can be attached to new customers and quotes. */
144
  public static TestClock create(Map<String, Object> params, RequestOptions options)
145
      throws StripeException {
146
    String path = "/v1/test_helpers/test_clocks";
×
147
    ApiRequest request =
×
148
        new ApiRequest(
149
            BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options, ApiMode.V1);
150
    return getGlobalResponseGetter().request(request, TestClock.class);
×
151
  }
152

153
  /** Creates a new test clock that can be attached to new customers and quotes. */
154
  public static TestClock create(TestClockCreateParams params) throws StripeException {
155
    return create(params, (RequestOptions) null);
1✔
156
  }
157

158
  /** Creates a new test clock that can be attached to new customers and quotes. */
159
  public static TestClock create(TestClockCreateParams params, RequestOptions options)
160
      throws StripeException {
161
    String path = "/v1/test_helpers/test_clocks";
1✔
162
    ApiResource.checkNullTypedParams(path, params);
1✔
163
    ApiRequest request =
1✔
164
        new ApiRequest(
165
            BaseAddress.API,
166
            ApiResource.RequestMethod.POST,
167
            path,
168
            ApiRequestParams.paramsToMap(params),
1✔
169
            options,
170
            ApiMode.V1);
171
    return getGlobalResponseGetter().request(request, TestClock.class);
1✔
172
  }
173

174
  /** Deletes a test clock. */
175
  public TestClock delete() throws StripeException {
176
    return delete((Map<String, Object>) null, (RequestOptions) null);
1✔
177
  }
178

179
  /** Deletes a test clock. */
180
  public TestClock delete(RequestOptions options) throws StripeException {
181
    return delete((Map<String, Object>) null, options);
×
182
  }
183

184
  /** Deletes a test clock. */
185
  public TestClock delete(Map<String, Object> params) throws StripeException {
186
    return delete(params, (RequestOptions) null);
×
187
  }
188

189
  /** Deletes a test clock. */
190
  public TestClock delete(Map<String, Object> params, RequestOptions options)
191
      throws StripeException {
192
    String path =
1✔
193
        String.format("/v1/test_helpers/test_clocks/%s", ApiResource.urlEncodeId(this.getId()));
1✔
194
    ApiRequest request =
1✔
195
        new ApiRequest(
196
            BaseAddress.API, ApiResource.RequestMethod.DELETE, path, params, options, ApiMode.V1);
197
    return getResponseGetter().request(request, TestClock.class);
1✔
198
  }
199

200
  /** Returns a list of your test clocks. */
201
  public static TestClockCollection list(Map<String, Object> params) throws StripeException {
202
    return list(params, (RequestOptions) null);
×
203
  }
204

205
  /** Returns a list of your test clocks. */
206
  public static TestClockCollection list(Map<String, Object> params, RequestOptions options)
207
      throws StripeException {
208
    String path = "/v1/test_helpers/test_clocks";
×
209
    ApiRequest request =
×
210
        new ApiRequest(
211
            BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options, ApiMode.V1);
212
    return getGlobalResponseGetter().request(request, TestClockCollection.class);
×
213
  }
214

215
  /** Returns a list of your test clocks. */
216
  public static TestClockCollection list(TestClockListParams params) throws StripeException {
217
    return list(params, (RequestOptions) null);
1✔
218
  }
219

220
  /** Returns a list of your test clocks. */
221
  public static TestClockCollection list(TestClockListParams params, RequestOptions options)
222
      throws StripeException {
223
    String path = "/v1/test_helpers/test_clocks";
1✔
224
    ApiResource.checkNullTypedParams(path, params);
1✔
225
    ApiRequest request =
1✔
226
        new ApiRequest(
227
            BaseAddress.API,
228
            ApiResource.RequestMethod.GET,
229
            path,
230
            ApiRequestParams.paramsToMap(params),
1✔
231
            options,
232
            ApiMode.V1);
233
    return getGlobalResponseGetter().request(request, TestClockCollection.class);
1✔
234
  }
235

236
  /** Retrieves a test clock. */
237
  public static TestClock retrieve(String testClock) throws StripeException {
238
    return retrieve(testClock, (Map<String, Object>) null, (RequestOptions) null);
1✔
239
  }
240

241
  /** Retrieves a test clock. */
242
  public static TestClock retrieve(String testClock, RequestOptions options)
243
      throws StripeException {
244
    return retrieve(testClock, (Map<String, Object>) null, options);
×
245
  }
246

247
  /** Retrieves a test clock. */
248
  public static TestClock retrieve(
249
      String testClock, Map<String, Object> params, RequestOptions options) throws StripeException {
250
    String path =
1✔
251
        String.format("/v1/test_helpers/test_clocks/%s", ApiResource.urlEncodeId(testClock));
1✔
252
    ApiRequest request =
1✔
253
        new ApiRequest(
254
            BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options, ApiMode.V1);
255
    return getGlobalResponseGetter().request(request, TestClock.class);
1✔
256
  }
257

258
  /** Retrieves a test clock. */
259
  public static TestClock retrieve(
260
      String testClock, TestClockRetrieveParams params, RequestOptions options)
261
      throws StripeException {
262
    String path =
×
263
        String.format("/v1/test_helpers/test_clocks/%s", ApiResource.urlEncodeId(testClock));
×
264
    ApiResource.checkNullTypedParams(path, params);
×
265
    ApiRequest request =
×
266
        new ApiRequest(
267
            BaseAddress.API,
268
            ApiResource.RequestMethod.GET,
269
            path,
270
            ApiRequestParams.paramsToMap(params),
×
271
            options,
272
            ApiMode.V1);
273
    return getGlobalResponseGetter().request(request, TestClock.class);
×
274
  }
275

276
  @Getter
277
  @Setter
278
  @EqualsAndHashCode(callSuper = false)
NEW
279
  public static class StatusDetails extends StripeObject {
×
280
    @SerializedName("advancing")
281
    Advancing advancing;
282

283
    @Getter
284
    @Setter
285
    @EqualsAndHashCode(callSuper = false)
NEW
286
    public static class Advancing extends StripeObject {
×
287
      /** The {@code frozen_time} that the Test Clock is advancing towards. */
288
      @SerializedName("target_frozen_time")
289
      Long targetFrozenTime;
290
    }
291
  }
292

293
  @Override
294
  public void setResponseGetter(StripeResponseGetter responseGetter) {
295
    super.setResponseGetter(responseGetter);
1✔
296
    trySetResponseGetter(statusDetails, responseGetter);
1✔
297
  }
1✔
298
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2024 Coveralls, Inc