recurly 3.13.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c48112c86ab321b7bb9d86cfcccf0e1189cd202c83a075c4432b7c626364a07
4
- data.tar.gz: 7e43cc5263d62818e7520468a23de1e8a7f80cf7d3060a9e08651aeb7c424e82
3
+ metadata.gz: 2bb35c82f1aea79ead43c5b2158031d946b71f6b21ce9118467d0f391fd000d6
4
+ data.tar.gz: 204672929d178c8bd4485d0386767469f27fed7965c1f8c64313424ecadb73c7
5
5
  SHA512:
6
- metadata.gz: d5e0f86d3a84696d2f3b23bb19ecd5188f49befd73350e2db32a2aa833e0e0c94e1ad1dbcf20d1f0ed964b1e0e1c8b581038c3beece02e452e7e81878e47bc5e
7
- data.tar.gz: 0c4f56e756ded152b7a25399168a4a595c003678f52ef14cce0c7e41d3f716aff94fc9b21d5cec9ce4ab9d95b0ae160bcba210b75fa4941fc67f5ebe2f4c268f
6
+ metadata.gz: fa8dfba5a7d51261f92dfdfe1fe232ac580a00180c1c304592834b60f22afe0d8ddc9256652b5be40d2c3fd35fa72442e99260dd9e6be922e31c57069e088b59
7
+ data.tar.gz: 8d0a7738e9f8d97d1a9f2129e984d033e22ae72de0913ffca507de8c30fb19961e02d828c6530fa75e43274179c3ff6c15288c96c57f8cf5e0f7b60ec9daae5a
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 3.13.0
2
+ current_version = 3.14.0
3
3
  parse = (?P<major>\d+)
4
4
  \.(?P<minor>\d+)
5
5
  \.(?P<patch>\d+)
@@ -1,8 +1,21 @@
1
1
  # Changelog
2
2
 
3
- ## [3.13.0](https://github.com/recurly/recurly-client-ruby/tree/HEAD)
3
+ ## [3.14.0](https://github.com/recurly/recurly-client-ruby/tree/HEAD)
4
4
 
5
- [Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.12.0...HEAD)
5
+ [Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.13.0...HEAD)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Mon Oct 19 20:38:03 UTC 2020 Upgrade API version v2019-10-10 [\#642](https://github.com/recurly/recurly-client-ruby/pull/642) ([douglasmiller](https://github.com/douglasmiller))
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Release 3.14.0 [\#643](https://github.com/recurly/recurly-client-ruby/pull/643) ([douglasmiller](https://github.com/douglasmiller))
14
+ - Fixes uninitialized constant `Recurly::Errors::ServiceNotAvailableError` [\#641](https://github.com/recurly/recurly-client-ruby/pull/641) ([ruyrocha](https://github.com/ruyrocha))
15
+
16
+ ## [3.13.0](https://github.com/recurly/recurly-client-ruby/tree/3.13.0) (2020-09-22)
17
+
18
+ [Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.12.0...3.13.0)
6
19
 
7
20
  **Implemented enhancements:**
8
21
 
@@ -5,7 +5,7 @@ This repository houses the official ruby client for Recurly's V3 API.
5
5
  In your Gemfile, add `recurly` as a dependency.
6
6
 
7
7
  ```ruby
8
- gem 'recurly', '~> 3.13'
8
+ gem 'recurly', '~> 3.14'
9
9
  ```
10
10
 
11
11
  > *Note*: We try to follow [semantic versioning](https://semver.org/) and will only apply breaking changes to major versions.
@@ -253,8 +253,13 @@ module Recurly
253
253
  def raise_api_error!(http_response, response)
254
254
  if response.content_type.include?(JSON_CONTENT_TYPE)
255
255
  error = JSONParser.parse(self, response.body)
256
- error_class = Errors::APIError.error_class(error.type)
257
- raise error_class.new(response, error)
256
+ begin
257
+ error_class = Errors::APIError.error_class(error.type)
258
+ raise error_class.new(response, error)
259
+ rescue NameError
260
+ error_class = Errors::APIError.from_response(http_response)
261
+ raise error_class.new(response, error)
262
+ end
258
263
  end
259
264
 
260
265
  error_class = Errors::APIError.from_response(http_response)
@@ -1364,6 +1364,21 @@ module Recurly
1364
1364
  delete(path, **options)
1365
1365
  end
1366
1366
 
1367
+ # Restore an inactive coupon
1368
+ #
1369
+ # {https://developers.recurly.com/api/v2019-10-10#operation/restore_coupon restore_coupon api documenation}
1370
+ #
1371
+ # @param coupon_id [String] Coupon ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-10off+.
1372
+ # @param body [Requests::CouponUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::CouponUpdate}
1373
+ # @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
1374
+ #
1375
+ # @return [Resources::Coupon] The restored coupon.
1376
+ #
1377
+ def restore_coupon(coupon_id:, body:, **options)
1378
+ path = interpolate_path("/coupons/{coupon_id}/restore", coupon_id: coupon_id)
1379
+ put(path, body, Requests::CouponUpdate, **options)
1380
+ end
1381
+
1367
1382
  # List unique coupon codes associated with a bulk coupon
1368
1383
  #
1369
1384
  # {https://developers.recurly.com/api/v2019-10-10#operation/list_unique_coupon_codes list_unique_coupon_codes api documenation}
@@ -3605,6 +3620,17 @@ module Recurly
3605
3620
  # @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
3606
3621
  #
3607
3622
  # @return [Resources::ExportDates] Returns a list of dates.
3623
+ # @example
3624
+ # begin
3625
+ # export_dates = @client.get_export_dates()
3626
+ # export_dates.dates.each do |date|
3627
+ # puts "Exports are available for: #{date}"
3628
+ # end
3629
+ # rescue Recurly::Errors::NotFoundError
3630
+ # # If the resource was not found, you may want to alert the user or
3631
+ # # just return nil
3632
+ # puts "Resource Not Found"
3633
+ # end
3608
3634
  #
3609
3635
  def get_export_dates(**options)
3610
3636
  path = interpolate_path("/export_dates")
@@ -3619,6 +3645,17 @@ module Recurly
3619
3645
  # @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
3620
3646
  #
3621
3647
  # @return [Resources::ExportFiles] Returns a list of export files to download.
3648
+ # @example
3649
+ # begin
3650
+ # export_files = @client.get_export_files(export_date: export_date)
3651
+ # export_files.files.each do |file|
3652
+ # puts "Export file download URL: #{file.href}"
3653
+ # end
3654
+ # rescue Recurly::Errors::NotFoundError
3655
+ # # If the resource was not found, you may want to alert the user or
3656
+ # # just return nil
3657
+ # puts "Resource Not Found"
3658
+ # end
3622
3659
  #
3623
3660
  def get_export_files(export_date:, **options)
3624
3661
  path = interpolate_path("/export_dates/{export_date}/export_files", export_date: export_date)
@@ -1,3 +1,3 @@
1
1
  module Recurly
2
- VERSION = "3.13.0"
2
+ VERSION = "3.14.0"
3
3
  end
@@ -5479,6 +5479,55 @@ paths:
5479
5479
  schema:
5480
5480
  "$ref": "#/components/schemas/Error"
5481
5481
  x-code-samples: []
5482
+ "/sites/{site_id}/coupons/{coupon_id}/restore":
5483
+ put:
5484
+ tags:
5485
+ - coupon
5486
+ operationId: restore_coupon
5487
+ summary: Restore an inactive coupon
5488
+ description: Make an expired coupon redeemable again. You can change editable
5489
+ fields in this call.
5490
+ parameters:
5491
+ - "$ref": "#/components/parameters/site_id"
5492
+ - "$ref": "#/components/parameters/coupon_id"
5493
+ requestBody:
5494
+ content:
5495
+ application/json:
5496
+ schema:
5497
+ "$ref": "#/components/schemas/CouponUpdate"
5498
+ required: true
5499
+ responses:
5500
+ '200':
5501
+ description: The restored coupon.
5502
+ content:
5503
+ application/json:
5504
+ schema:
5505
+ "$ref": "#/components/schemas/Coupon"
5506
+ '400':
5507
+ description: Bad request, perhaps invalid JSON?
5508
+ content:
5509
+ application/json:
5510
+ schema:
5511
+ "$ref": "#/components/schemas/Error"
5512
+ '404':
5513
+ description: Incorrect site or coupon ID.
5514
+ content:
5515
+ application/json:
5516
+ schema:
5517
+ "$ref": "#/components/schemas/Error"
5518
+ '422':
5519
+ description: Invalid request parameters
5520
+ content:
5521
+ application/json:
5522
+ schema:
5523
+ "$ref": "#/components/schemas/Error"
5524
+ default:
5525
+ description: Unexpected error.
5526
+ content:
5527
+ application/json:
5528
+ schema:
5529
+ "$ref": "#/components/schemas/Error"
5530
+ x-code-samples: []
5482
5531
  "/sites/{site_id}/coupons/{coupon_id}/unique_coupon_codes":
5483
5532
  get:
5484
5533
  tags:
@@ -13666,7 +13715,83 @@ paths:
13666
13715
  application/json:
13667
13716
  schema:
13668
13717
  "$ref": "#/components/schemas/Error"
13669
- x-code-samples: []
13718
+ x-code-samples:
13719
+ - lang: Node.js
13720
+ source: |
13721
+ try {
13722
+ const export_dates = await client.getExportDates()
13723
+ export_dates.dates.forEach(date => {
13724
+ console.log(`Exports are available for: ${date}`)
13725
+ })
13726
+ } catch (err) {
13727
+ if (err instanceof recurly.ApiError) {
13728
+ console.log('Unexpected error', err)
13729
+ }
13730
+ }
13731
+ - lang: Python
13732
+ source: |
13733
+ try:
13734
+ export_dates = client.get_export_dates()
13735
+ for date in export_dates.dates:
13736
+ print( "Exports are available for: %s" % date)
13737
+ except recurly.errors.NotFoundError:
13738
+ # If the resource was not found, you may want to alert the user or
13739
+ # just return nil
13740
+ print("Resource Not Found")
13741
+ - lang: ".NET"
13742
+ source: |
13743
+ try
13744
+ {
13745
+ ExportDates exportDates = client.GetExportDates();
13746
+ foreach (var date in exportDates.Dates)
13747
+ {
13748
+ System.Console.WriteLine($"Exports are available for: {date}");
13749
+ }
13750
+ }
13751
+ catch (Recurly.Errors.ApiError ex)
13752
+ {
13753
+ // Use ApiError to catch a generic error from the API
13754
+ Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
13755
+ }
13756
+ - lang: Ruby
13757
+ source: |
13758
+ begin
13759
+ export_dates = @client.get_export_dates()
13760
+ export_dates.dates.each do |date|
13761
+ puts "Exports are available for: #{date}"
13762
+ end
13763
+ rescue Recurly::Errors::NotFoundError
13764
+ # If the resource was not found, you may want to alert the user or
13765
+ # just return nil
13766
+ puts "Resource Not Found"
13767
+ end
13768
+ - lang: Java
13769
+ source: |
13770
+ try {
13771
+ ExportDates exportDates = client.getExportDates();
13772
+ for (String date : exportDates.getDates()) {
13773
+ System.out.println("Exports are available for: " + date);
13774
+ }
13775
+ } catch (ApiException e) {
13776
+ // Use ApiException to catch a generic error from the API
13777
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
13778
+ }
13779
+ - lang: PHP
13780
+ source: |
13781
+ try {
13782
+ $export_dates = $client->getExportDates();
13783
+ foreach($export_dates->getDates() as $date)
13784
+ {
13785
+ echo "Exports are available for: {$date}" . PHP_EOL;
13786
+ }
13787
+ } catch (\Recurly\RecurlyError $e) {
13788
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
13789
+ }
13790
+ - lang: Go
13791
+ source: "exportDates, err := client.GetExportDates()\nif e, ok := err.(*recurly.Error);
13792
+ ok {\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfor
13793
+ _, date := range exportDates.Dates {\n\tfmt.Println(\"Exports are available
13794
+ for: \", date)\n}"
13670
13795
  "/sites/{site_id}/export_dates/{export_date}/export_files":
13671
13796
  parameters:
13672
13797
  - "$ref": "#/components/parameters/site_id"
@@ -13703,7 +13828,83 @@ paths:
13703
13828
  application/json:
13704
13829
  schema:
13705
13830
  "$ref": "#/components/schemas/Error"
13706
- x-code-samples: []
13831
+ x-code-samples:
13832
+ - lang: Node.js
13833
+ source: |
13834
+ try {
13835
+ const export_files = await client.getExportFiles(export_date)
13836
+ export_files.files.forEach(file => {
13837
+ console.log(`Export file download URL: ${file.href}`)
13838
+ })
13839
+ } catch (err) {
13840
+ if (err instanceof recurly.ApiError) {
13841
+ console.log('Unexpected error', err)
13842
+ }
13843
+ }
13844
+ - lang: Python
13845
+ source: |
13846
+ try:
13847
+ export_files = client.get_export_files(export_date)
13848
+ for file in export_files.files:
13849
+ print( "Export file download URL: %s" % file.href)
13850
+ except recurly.errors.NotFoundError:
13851
+ # If the resource was not found, you may want to alert the user or
13852
+ # just return nil
13853
+ print("Resource Not Found")
13854
+ - lang: ".NET"
13855
+ source: |
13856
+ try
13857
+ {
13858
+ ExportFiles exportFiles = client.GetExportFiles(exportDate: exportDate);
13859
+ foreach (var file in exportFiles.Files)
13860
+ {
13861
+ System.Console.WriteLine($"Export file download URL: {file.Href}");
13862
+ }
13863
+ }
13864
+ catch (Recurly.Errors.ApiError ex)
13865
+ {
13866
+ // Use ApiError to catch a generic error from the API
13867
+ Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
13868
+ }
13869
+ - lang: Ruby
13870
+ source: |
13871
+ begin
13872
+ export_files = @client.get_export_files(export_date: export_date)
13873
+ export_files.files.each do |file|
13874
+ puts "Export file download URL: #{file.href}"
13875
+ end
13876
+ rescue Recurly::Errors::NotFoundError
13877
+ # If the resource was not found, you may want to alert the user or
13878
+ # just return nil
13879
+ puts "Resource Not Found"
13880
+ end
13881
+ - lang: Java
13882
+ source: |
13883
+ try {
13884
+ ExportFiles exportFiles = client.getExportFiles(exportDate);
13885
+ for (ExportFile file : exportFiles.getFiles()) {
13886
+ System.out.println("Export file download URL: " + file.getHref());
13887
+ }
13888
+ } catch (ApiException e) {
13889
+ // Use ApiException to catch a generic error from the API
13890
+ System.out.println("Unexpected Recurly Error: " + e.getError());
13891
+ }
13892
+ - lang: PHP
13893
+ source: |
13894
+ try {
13895
+ $export_files = $client->getExportFiles($export_date);
13896
+ foreach($export_files->getFiles() as $file)
13897
+ {
13898
+ echo "Export file download URL: {$file->getHref()}" . PHP_EOL;
13899
+ }
13900
+ } catch (\Recurly\RecurlyError $e) {
13901
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
13902
+ }
13903
+ - lang: Go
13904
+ source: "exportFiles, err := client.GetExportFiles(exportDate)\nif e, ok :=
13905
+ err.(*recurly.Error); ok {\n\tfmt.Printf(\"Unexpected Recurly error: %v\",
13906
+ e)\n\treturn nil, err\n}\n\nfor _, file := range exportFiles.Files {\n\tfmt.Println(\"Export
13907
+ file download URL: \", file.Href)\n}"
13707
13908
  servers:
13708
13909
  - url: https://v3.recurly.com
13709
13910
  components:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.13.0
4
+ version: 3.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-22 00:00:00.000000000 Z
11
+ date: 2020-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -293,7 +293,7 @@ metadata:
293
293
  changelog_uri: https://github.com/recurly/recurly-client-ruby/blob/master/CHANGELOG.md
294
294
  documentation_uri: https://recurly.github.io/recurly-client-ruby/
295
295
  homepage_uri: https://github.com/recurly/recurly-client-ruby
296
- source_code_uri: https://github.com/recurly/recurly-client-ruby/tree/3.13.0
296
+ source_code_uri: https://github.com/recurly/recurly-client-ruby/tree/3.14.0
297
297
  post_install_message:
298
298
  rdoc_options: []
299
299
  require_paths: