recurly 3.0.0.beta.2 → 3.0.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +1 -1
  4. data/lib/recurly/client.rb +39 -37
  5. data/lib/recurly/client/adapter.rb +46 -0
  6. data/lib/recurly/client/operations.rb +626 -170
  7. data/lib/recurly/errors.rb +1 -1
  8. data/lib/recurly/requests/{create_account.rb → account_create.rb} +5 -1
  9. data/lib/recurly/requests/{account_updatable.rb → account_update.rb} +5 -1
  10. data/lib/recurly/requests/add_on_create.rb +2 -2
  11. data/lib/recurly/requests/add_on_update.rb +2 -2
  12. data/lib/recurly/requests/coupon_bulk_create.rb +10 -0
  13. data/lib/recurly/requests/{create_coupon.rb → coupon_create.rb} +3 -3
  14. data/lib/recurly/requests/coupon_redemption_create.rb +14 -0
  15. data/lib/recurly/requests/{update_coupon.rb → coupon_update.rb} +1 -1
  16. data/lib/recurly/requests/invoice_refund.rb +2 -2
  17. data/lib/recurly/requests/line_item_refund.rb +18 -0
  18. data/lib/recurly/requests/plan_create.rb +8 -4
  19. data/lib/recurly/requests/plan_update.rb +8 -12
  20. data/lib/recurly/requests/subscription_add_on_create.rb +0 -4
  21. data/lib/recurly/requests/subscription_create.rb +21 -9
  22. data/lib/recurly/requests/subscription_pause.rb +10 -0
  23. data/lib/recurly/requests/subscription_update.rb +16 -4
  24. data/lib/recurly/resources/account.rb +4 -0
  25. data/lib/recurly/resources/account_acquisition.rb +2 -2
  26. data/lib/recurly/resources/account_balance.rb +2 -2
  27. data/lib/recurly/resources/add_on.rb +2 -2
  28. data/lib/recurly/resources/coupon.rb +2 -2
  29. data/lib/recurly/resources/coupon_discount.rb +2 -2
  30. data/lib/recurly/resources/coupon_redemption_mini.rb +2 -2
  31. data/lib/recurly/resources/credit_payment.rb +6 -6
  32. data/lib/recurly/resources/custom_field.rb +14 -0
  33. data/lib/recurly/resources/custom_field_definition.rb +46 -0
  34. data/lib/recurly/resources/error.rb +2 -2
  35. data/lib/recurly/resources/error_may_have_transaction.rb +2 -2
  36. data/lib/recurly/resources/invoice.rb +4 -4
  37. data/lib/recurly/resources/line_item.rb +3 -3
  38. data/lib/recurly/resources/line_item_list.rb +22 -0
  39. data/lib/recurly/resources/plan.rb +6 -2
  40. data/lib/recurly/resources/subscription.rb +37 -5
  41. data/lib/recurly/resources/subscription_add_on.rb +2 -2
  42. data/lib/recurly/resources/subscription_change.rb +2 -2
  43. data/lib/recurly/resources/transaction.rb +6 -6
  44. data/lib/recurly/version.rb +1 -1
  45. data/recurly.gemspec +1 -0
  46. metadata +28 -21
  47. data/bin/bundle +0 -105
  48. data/bin/coderay +0 -29
  49. data/bin/console +0 -14
  50. data/bin/htmldiff +0 -29
  51. data/bin/ldiff +0 -29
  52. data/bin/pry +0 -29
  53. data/bin/rake +0 -29
  54. data/bin/rspec +0 -29
  55. data/bin/setup +0 -8
  56. data/bin/yard +0 -29
  57. data/bin/yardoc +0 -29
  58. data/bin/yri +0 -29
  59. data/lib/recurly/requests/account_create_only.rb +0 -18
  60. data/lib/recurly/requests/coupon_create_only.rb +0 -66
  61. data/lib/recurly/requests/coupon_updatable.rb +0 -30
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'coderay' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("coderay", "coderay")
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "recurly"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'htmldiff' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("diff-lcs", "htmldiff")
data/bin/ldiff DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'ldiff' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("diff-lcs", "ldiff")
data/bin/pry DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'pry' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("pry", "pry")
data/bin/rake DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rake' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rake", "rake")
data/bin/rspec DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rspec' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rspec-core", "rspec")
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/bin/yard DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'yard' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("yard", "yard")
data/bin/yardoc DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'yardoc' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("yard", "yardoc")
data/bin/yri DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'yri' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("yard", "yri")
@@ -1,18 +0,0 @@
1
- module Recurly
2
- module Requests
3
- class AccountCreateOnly < Request
4
-
5
- # @!attribute acquisition
6
- # @return [AccountAcquisitionUpdatable]
7
- define_attribute :acquisition, :AccountAcquisitionUpdatable
8
-
9
- # @!attribute code
10
- # @return [String] The unique identifier of the account. This cannot be changed once the account is created.
11
- define_attribute :code, String
12
-
13
- # @!attribute shipping_addresses
14
- # @return [Array[ShippingAddressCreate]]
15
- define_attribute :shipping_addresses, Array, {:item_type => :ShippingAddressCreate}
16
- end
17
- end
18
- end
@@ -1,66 +0,0 @@
1
- module Recurly
2
- module Requests
3
- class CouponCreateOnly < Request
4
-
5
- # @!attribute applies_to_all_plans
6
- # @return [Boolean] The coupon is valid for all plans if true. If false then `plans` and `plans_names` will list the applicable plans.
7
- define_attribute :applies_to_all_plans, :Boolean
8
-
9
- # @!attribute applies_to_non_plan_charges
10
- # @return [Boolean] The coupon is valid for one-time, non-plan charges if true.
11
- define_attribute :applies_to_non_plan_charges, :Boolean
12
-
13
- # @!attribute code
14
- # @return [String] The code the customer enters to redeem the coupon.
15
- define_attribute :code, String
16
-
17
- # @!attribute coupon_type
18
- # @return [String] Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint.
19
- define_attribute :coupon_type, String, {:enum => ["single_code", "bulk"]}
20
-
21
- # @!attribute currencies
22
- # @return [Array[String]] Fixed discount currencies by currency. Required if the coupon type is `fixed`. This parameter should contain the coupon discount values
23
- define_attribute :currencies, Array, {:item_type => String}
24
-
25
- # @!attribute discount_percent
26
- # @return [Integer] The percent of the price discounted by the coupon. Required if `discount_type` is `percent`.
27
- define_attribute :discount_percent, Integer
28
-
29
- # @!attribute discount_type
30
- # @return [String] The type of discount provided by the coupon (how the amount discounted is calculated)
31
- define_attribute :discount_type, String, {:enum => ["percent", "fixed", "free_trial"]}
32
-
33
- # @!attribute duration
34
- # @return [String] This field does not apply when the discount_type is `free_trial`. - "single_use" coupons applies to the first invoice only. - "temporal" coupons will apply to invoices for the duration determined by the `temporal_unit` and `temporal_amount` attributes. - "forever" coupons will apply to invoices forever.
35
- define_attribute :duration, String, {:enum => ["forever", "single_use", "temporal"]}
36
-
37
- # @!attribute free_trial_amount
38
- # @return [Integer] Sets the duration of time the `free_trial_unit` is for. Required if `discount_type` is `free_trial`.
39
- define_attribute :free_trial_amount, Integer
40
-
41
- # @!attribute free_trial_unit
42
- # @return [String] Description of the unit of time the coupon is for. Used with `free_trial_amount` to determine the duration of time the coupon is for. Required if `discount_type` is `free_trial`.
43
- define_attribute :free_trial_unit, String, {:enum => ["day", "week", "month"]}
44
-
45
- # @!attribute plan_codes
46
- # @return [Array[String]] List of plan codes to which this coupon applies. See `applies_to_all_plans`
47
- define_attribute :plan_codes, Array, {:item_type => String}
48
-
49
- # @!attribute redemption_resource
50
- # @return [String] Whether the discount is for all eligible charges on the account, or only a specific subscription.
51
- define_attribute :redemption_resource, String, {:enum => ["account", "subscription"]}
52
-
53
- # @!attribute temporal_amount
54
- # @return [Integer] If `duration` is "temporal" than `temporal_amount` is an integer which is multiplied by `temporal_unit` to define the duration that the coupon will be applied to invoices for.
55
- define_attribute :temporal_amount, Integer
56
-
57
- # @!attribute temporal_unit
58
- # @return [String] If `duration` is "temporal" than `temporal_unit` is multiplied by `temporal_amount` to define the duration that the coupon will be applied to invoices for.
59
- define_attribute :temporal_unit, String, {:enum => ["day", "week", "month", "year"]}
60
-
61
- # @!attribute unique_code_template
62
- # @return [String] On a bulk coupon, the template from which unique coupon codes are generated. - You must start the template with your coupon_code wrapped in single quotes. - Outside of single quotes, use a 9 for a character that you want to be a random number. - Outside of single quotes, use an "x" for a character that you want to be a random letter. - Outside of single quotes, use an * for a character that you want to be a random number or letter. - Use single quotes ' ' for characters that you want to remain static. These strings can be alphanumeric and may contain a - _ or +. For example: "'abc-'****'-def'"
63
- define_attribute :unique_code_template, String
64
- end
65
- end
66
- end
@@ -1,30 +0,0 @@
1
- module Recurly
2
- module Requests
3
- class CouponUpdatable < Request
4
-
5
- # @!attribute hosted_description
6
- # @return [String] This description will show up when a customer redeems a coupon on your Hosted Payment Pages, or if you choose to show the description on your own checkout page.
7
- define_attribute :hosted_description, String
8
-
9
- # @!attribute invoice_description
10
- # @return [String] Description of the coupon on the invoice.
11
- define_attribute :invoice_description, String
12
-
13
- # @!attribute max_redemptions
14
- # @return [Integer] A maximum number of redemptions for the coupon. The coupon will expire when it hits its maximum redemptions.
15
- define_attribute :max_redemptions, Integer
16
-
17
- # @!attribute max_redemptions_per_account
18
- # @return [Integer] Redemptions per account is the number of times a specific account can redeem the coupon. Set redemptions per account to `1` if you want to keep customers from gaming the system and getting more than one discount from the coupon campaign.
19
- define_attribute :max_redemptions_per_account, Integer
20
-
21
- # @!attribute name
22
- # @return [String] The internal name for the coupon.
23
- define_attribute :name, String
24
-
25
- # @!attribute redeem_by_date
26
- # @return [String] The date and time the coupon will expire and can no longer be redeemed. Time is always 11:59:59, the end-of-day Pacific time.
27
- define_attribute :redeem_by_date, String
28
- end
29
- end
30
- end