recurly 3.0.0.beta.1 → 3.0.0.beta.2
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 +4 -4
- data/.travis.yml +4 -1
- data/lib/recurly/client.rb +1 -1
- data/lib/recurly/client/operations.rb +20 -20
- data/lib/recurly/request.rb +1 -0
- data/lib/recurly/resources/account_acquisition.rb +2 -2
- data/lib/recurly/resources/account_balance.rb +2 -2
- data/lib/recurly/resources/account_mini.rb +30 -0
- data/lib/recurly/resources/add_on_mini.rb +26 -0
- data/lib/recurly/resources/coupon_mini.rb +38 -0
- data/lib/recurly/resources/coupon_redemption_mini.rb +30 -0
- data/lib/recurly/resources/credit_payment.rb +6 -6
- data/lib/recurly/resources/invoice.rb +2 -2
- data/lib/recurly/resources/invoice_mini.rb +26 -0
- data/lib/recurly/resources/line_item.rb +2 -2
- data/lib/recurly/resources/plan_mini.rb +22 -0
- data/lib/recurly/resources/subscription.rb +4 -4
- data/lib/recurly/resources/subscription_add_on.rb +2 -2
- data/lib/recurly/resources/subscription_change.rb +2 -2
- data/lib/recurly/resources/transaction.rb +6 -6
- data/lib/recurly/schema.rb +8 -1
- data/lib/recurly/schema/json_deserializer.rb +18 -14
- data/lib/recurly/schema/schema_validator.rb +1 -1
- data/lib/recurly/version.rb +1 -1
- data/recurly.gemspec +1 -1
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eff2defc3b440056f3a6fde80b0d8a7f2ec6e514e317666fe28f9f0d7f7a10b
|
4
|
+
data.tar.gz: 540a0e4f98a3a366974e650471e93e4fc70e2e54f2c9004905a6633cc066c4fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 503ebf6c95d9195f90fc221d1ff125d99626c5608648a913f8480c02c57a9229141cedd86004394db94fa1fe69f2549b740934d91eca85d5da86d666cec51d1d
|
7
|
+
data.tar.gz: d77e6d6c319e9a16007f470300f4358be1048673c9783cf92b06347043c0db1609c2f2eb0c6d991a7f2856749be3f15407595e6d0d39796f26522c3fa4fcd2d8
|
data/.travis.yml
CHANGED
data/lib/recurly/client.rb
CHANGED
@@ -103,7 +103,7 @@ module Recurly
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def get(path, **options)
|
106
|
-
response = run_request(:get, path,
|
106
|
+
response = run_request(:get, path, nil, headers)
|
107
107
|
raise_api_error!(response) if response.status != 200
|
108
108
|
JSONParser.parse(self, response.body)
|
109
109
|
rescue Faraday::ClientError => ex
|
@@ -42,7 +42,7 @@ module Recurly
|
|
42
42
|
|
43
43
|
# Create an account
|
44
44
|
#
|
45
|
-
# @param body [Requests::CreateAccount] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
45
|
+
# @param body [Requests::CreateAccount] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::CreateAccount}
|
46
46
|
# @return [Resources::Account] An account.
|
47
47
|
def create_account(body:)
|
48
48
|
path = interpolate_path("/sites/{site_id}/accounts", site_id: site_id)
|
@@ -74,7 +74,7 @@ module Recurly
|
|
74
74
|
# Modify an account
|
75
75
|
#
|
76
76
|
# @param account_id [String] Account ID or code (use prefix: `code-`, e.g. `code-bob`).
|
77
|
-
# @param body [Requests::AccountUpdatable] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
77
|
+
# @param body [Requests::AccountUpdatable] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AccountUpdatable}
|
78
78
|
# @return [Resources::Account] An account.
|
79
79
|
def update_account(account_id:, body:)
|
80
80
|
path = interpolate_path("/sites/{site_id}/accounts/{account_id}", site_id: site_id, account_id: account_id)
|
@@ -102,7 +102,7 @@ module Recurly
|
|
102
102
|
# Update an account's acquisition data
|
103
103
|
#
|
104
104
|
# @param account_id [String] Account ID or code (use prefix: `code-`, e.g. `code-bob`).
|
105
|
-
# @param body [Requests::AccountAcquisitionUpdatable] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
105
|
+
# @param body [Requests::AccountAcquisitionUpdatable] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AccountAcquisitionUpdatable}
|
106
106
|
# @return [Resources::AccountAcquisition] An account's updated acquisition data.
|
107
107
|
def update_account_acquisition(account_id:, body:)
|
108
108
|
path = interpolate_path("/sites/{site_id}/accounts/{account_id}/acquisition", site_id: site_id, account_id: account_id)
|
@@ -147,7 +147,7 @@ module Recurly
|
|
147
147
|
# Set an account's billing information
|
148
148
|
#
|
149
149
|
# @param account_id [String] Account ID or code (use prefix: `code-`, e.g. `code-bob`).
|
150
|
-
# @param body [Requests::BillingInfoCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
150
|
+
# @param body [Requests::BillingInfoCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::BillingInfoCreate}
|
151
151
|
# @return [Resources::BillingInfo] Updated billing information.
|
152
152
|
def update_billing_info(account_id:, body:)
|
153
153
|
path = interpolate_path("/sites/{site_id}/accounts/{account_id}/billing_info", site_id: site_id, account_id: account_id)
|
@@ -184,7 +184,7 @@ module Recurly
|
|
184
184
|
# Generate an active coupon redemption on an account
|
185
185
|
#
|
186
186
|
# @param account_id [String] Account ID or code (use prefix: `code-`, e.g. `code-bob`).
|
187
|
-
# @param body [Requests::CreateCouponRedemption] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
187
|
+
# @param body [Requests::CreateCouponRedemption] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::CreateCouponRedemption}
|
188
188
|
# @return [Resources::CouponRedemption] Returns the new coupon redemption.
|
189
189
|
def create_coupon_redemption(account_id:, body:)
|
190
190
|
path = interpolate_path("/sites/{site_id}/accounts/{account_id}/coupon_redemptions/active", site_id: site_id, account_id: account_id)
|
@@ -233,7 +233,7 @@ module Recurly
|
|
233
233
|
# Create an invoice for pending line items
|
234
234
|
#
|
235
235
|
# @param account_id [String] Account ID or code (use prefix: `code-`, e.g. `code-bob`).
|
236
|
-
# @param body [Requests::InvoiceCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
236
|
+
# @param body [Requests::InvoiceCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceCreate}
|
237
237
|
# @return [Resources::InvoiceCollection] Returns the new invoices.
|
238
238
|
def create_invoice(account_id:, body:)
|
239
239
|
path = interpolate_path("/sites/{site_id}/accounts/{account_id}/invoices", site_id: site_id, account_id: account_id)
|
@@ -243,7 +243,7 @@ module Recurly
|
|
243
243
|
# Preview new invoice for pending line items
|
244
244
|
#
|
245
245
|
# @param account_id [String] Account ID or code (use prefix: `code-`, e.g. `code-bob`).
|
246
|
-
# @param body [Requests::InvoiceCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
246
|
+
# @param body [Requests::InvoiceCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceCreate}
|
247
247
|
# @return [Resources::InvoiceCollection] Returns the invoice previews.
|
248
248
|
def preview_invoice(account_id:, body:)
|
249
249
|
path = interpolate_path("/sites/{site_id}/accounts/{account_id}/invoices/preview", site_id: site_id, account_id: account_id)
|
@@ -271,7 +271,7 @@ module Recurly
|
|
271
271
|
# Create a new line item for the account
|
272
272
|
#
|
273
273
|
# @param account_id [String] Account ID or code (use prefix: `code-`, e.g. `code-bob`).
|
274
|
-
# @param body [Requests::LineItemCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
274
|
+
# @param body [Requests::LineItemCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::LineItemCreate}
|
275
275
|
# @return [Resources::LineItem] Returns the new line item.
|
276
276
|
def create_line_item(account_id:, body:)
|
277
277
|
path = interpolate_path("/sites/{site_id}/accounts/{account_id}/line_items", site_id: site_id, account_id: account_id)
|
@@ -316,7 +316,7 @@ module Recurly
|
|
316
316
|
# Create a new shipping address for the account
|
317
317
|
#
|
318
318
|
# @param account_id [String] Account ID or code (use prefix: `code-`, e.g. `code-bob`).
|
319
|
-
# @param body [Requests::ShippingAddressCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
319
|
+
# @param body [Requests::ShippingAddressCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ShippingAddressCreate}
|
320
320
|
# @return [Resources::ShippingAddress] Returns the new shipping address.
|
321
321
|
def create_shipping_address(account_id:, body:)
|
322
322
|
path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses", site_id: site_id, account_id: account_id)
|
@@ -337,7 +337,7 @@ module Recurly
|
|
337
337
|
#
|
338
338
|
# @param account_id [String] Account ID or code (use prefix: `code-`, e.g. `code-bob`).
|
339
339
|
# @param shipping_address_id [String] Shipping Address ID.
|
340
|
-
# @param body [Requests::ShippingAddressUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
340
|
+
# @param body [Requests::ShippingAddressUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ShippingAddressUpdate}
|
341
341
|
# @return [Resources::ShippingAddress] The updated shipping address.
|
342
342
|
def update_shipping_address(account_id:, shipping_address_id:, body:)
|
343
343
|
path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses/{shipping_address_id}", site_id: site_id, account_id: account_id, shipping_address_id: shipping_address_id)
|
@@ -416,7 +416,7 @@ module Recurly
|
|
416
416
|
|
417
417
|
# Create a new coupon
|
418
418
|
#
|
419
|
-
# @param body [Requests::CreateCoupon] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
419
|
+
# @param body [Requests::CreateCoupon] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::CreateCoupon}
|
420
420
|
# @return [Resources::Coupon] A new coupon.
|
421
421
|
def create_coupon(body:)
|
422
422
|
path = interpolate_path("/sites/{site_id}/coupons", site_id: site_id)
|
@@ -435,7 +435,7 @@ module Recurly
|
|
435
435
|
# Update an active coupon
|
436
436
|
#
|
437
437
|
# @param coupon_id [String] Coupon ID or code (use prefix: `code-`, e.g. `code-10off`).
|
438
|
-
# @param body [Requests::UpdateCoupon] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
438
|
+
# @param body [Requests::UpdateCoupon] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::UpdateCoupon}
|
439
439
|
# @return [Resources::Coupon] The updated coupon.
|
440
440
|
def update_coupon(coupon_id:, body:)
|
441
441
|
path = interpolate_path("/sites/{site_id}/coupons/{coupon_id}", site_id: site_id, coupon_id: coupon_id)
|
@@ -579,7 +579,7 @@ module Recurly
|
|
579
579
|
# Refund an invoice
|
580
580
|
#
|
581
581
|
# @param invoice_id [String] Invoice ID or number (use prefix: `number-`, e.g. `number-1000`).
|
582
|
-
# @param body [Requests::InvoiceRefund] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
582
|
+
# @param body [Requests::InvoiceRefund] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceRefund}
|
583
583
|
# @return [Resources::Invoice] Returns the new credit invoice.
|
584
584
|
def refund_invoice(invoice_id:, body:)
|
585
585
|
path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/refund", site_id: site_id, invoice_id: invoice_id)
|
@@ -637,7 +637,7 @@ module Recurly
|
|
637
637
|
|
638
638
|
# Create a plan
|
639
639
|
#
|
640
|
-
# @param body [Requests::PlanCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
640
|
+
# @param body [Requests::PlanCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PlanCreate}
|
641
641
|
# @return [Resources::Plan] A plan.
|
642
642
|
def create_plan(body:)
|
643
643
|
path = interpolate_path("/sites/{site_id}/plans", site_id: site_id)
|
@@ -656,7 +656,7 @@ module Recurly
|
|
656
656
|
# Update a plan
|
657
657
|
#
|
658
658
|
# @param plan_id [String] Plan ID or code (use prefix: `code-`, e.g. `code-gold`).
|
659
|
-
# @param body [Requests::PlanUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
659
|
+
# @param body [Requests::PlanUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PlanUpdate}
|
660
660
|
# @return [Resources::Plan] A plan.
|
661
661
|
def update_plan(plan_id:, body:)
|
662
662
|
path = interpolate_path("/sites/{site_id}/plans/{plan_id}", site_id: site_id, plan_id: plan_id)
|
@@ -691,7 +691,7 @@ module Recurly
|
|
691
691
|
# Create an add-on
|
692
692
|
#
|
693
693
|
# @param plan_id [String] Plan ID or code (use prefix: `code-`, e.g. `code-gold`).
|
694
|
-
# @param body [Requests::AddOnCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
694
|
+
# @param body [Requests::AddOnCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AddOnCreate}
|
695
695
|
# @return [Resources::AddOn] An add-on.
|
696
696
|
def create_plan_add_on(plan_id:, body:)
|
697
697
|
path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons", site_id: site_id, plan_id: plan_id)
|
@@ -712,7 +712,7 @@ module Recurly
|
|
712
712
|
#
|
713
713
|
# @param add_on_id [String] Add-on ID or code (use prefix: `code-`, e.g. `code-gold`).
|
714
714
|
# @param plan_id [String] Plan ID or code (use prefix: `code-`, e.g. `code-gold`).
|
715
|
-
# @param body [Requests::AddOnUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
715
|
+
# @param body [Requests::AddOnUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AddOnUpdate}
|
716
716
|
# @return [Resources::AddOn] An add-on.
|
717
717
|
def update_plan_add_on(add_on_id:, plan_id:, body:)
|
718
718
|
path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons/{add_on_id}", site_id: site_id, add_on_id: add_on_id, plan_id: plan_id)
|
@@ -770,7 +770,7 @@ module Recurly
|
|
770
770
|
|
771
771
|
# Create a new subscription
|
772
772
|
#
|
773
|
-
# @param body [Requests::SubscriptionCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
773
|
+
# @param body [Requests::SubscriptionCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionCreate}
|
774
774
|
# @return [Resources::Subscription] A subscription.
|
775
775
|
def create_subscription(body:)
|
776
776
|
path = interpolate_path("/sites/{site_id}/subscriptions", site_id: site_id)
|
@@ -802,7 +802,7 @@ module Recurly
|
|
802
802
|
# Modify a subscription
|
803
803
|
#
|
804
804
|
# @param subscription_id [String] Subscription ID or UUID (use prefix: `uuid-`, e.g. `uuid-123457890`).
|
805
|
-
# @param body [Requests::SubscriptionUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
805
|
+
# @param body [Requests::SubscriptionUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionUpdate}
|
806
806
|
# @return [Resources::Subscription] A subscription.
|
807
807
|
def modify_subscription(subscription_id:, body:)
|
808
808
|
path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}", site_id: site_id, subscription_id: subscription_id)
|
@@ -849,7 +849,7 @@ module Recurly
|
|
849
849
|
# Create a new subscription change
|
850
850
|
#
|
851
851
|
# @param subscription_id [String] Subscription ID or UUID (use prefix: `uuid-`, e.g. `uuid-123457890`).
|
852
|
-
# @param body [Requests::SubscriptionChangeCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::
|
852
|
+
# @param body [Requests::SubscriptionChangeCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionChangeCreate}
|
853
853
|
# @return [Resources::SubscriptionChange] A subscription change.
|
854
854
|
def create_subscription_change(subscription_id:, body:)
|
855
855
|
path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/change", site_id: site_id, subscription_id: subscription_id)
|
data/lib/recurly/request.rb
CHANGED
@@ -3,8 +3,8 @@ module Recurly
|
|
3
3
|
class AccountAcquisition < Resource
|
4
4
|
|
5
5
|
# @!attribute account
|
6
|
-
# @return [
|
7
|
-
define_attribute :account, :
|
6
|
+
# @return [Account]
|
7
|
+
define_attribute :account, :Account
|
8
8
|
|
9
9
|
# @!attribute campaign
|
10
10
|
# @return [String] An arbitrary identifier for the marketing campaign that led to the acquisition of this account.
|
@@ -3,8 +3,8 @@ module Recurly
|
|
3
3
|
class AccountBalance < Resource
|
4
4
|
|
5
5
|
# @!attribute account
|
6
|
-
# @return [
|
7
|
-
define_attribute :account, :
|
6
|
+
# @return [Account]
|
7
|
+
define_attribute :account, :Account
|
8
8
|
|
9
9
|
# @!attribute balances
|
10
10
|
# @return [Hash] Account balance
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Resources
|
3
|
+
class AccountMini < Resource
|
4
|
+
|
5
|
+
# @!attribute code
|
6
|
+
# @return [String] The unique identifier of the account.
|
7
|
+
define_attribute :code, String
|
8
|
+
|
9
|
+
# @!attribute email
|
10
|
+
# @return [String] The email address used for communicating with this customer.
|
11
|
+
define_attribute :email, String
|
12
|
+
|
13
|
+
# @!attribute first_name
|
14
|
+
# @return [String]
|
15
|
+
define_attribute :first_name, String
|
16
|
+
|
17
|
+
# @!attribute [r] id
|
18
|
+
# @return [String]
|
19
|
+
define_attribute :id, String, {:read_only => true}
|
20
|
+
|
21
|
+
# @!attribute last_name
|
22
|
+
# @return [String]
|
23
|
+
define_attribute :last_name, String
|
24
|
+
|
25
|
+
# @!attribute [r] object
|
26
|
+
# @return [String] Object type
|
27
|
+
define_attribute :object, String, {:read_only => true}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Resources
|
3
|
+
class AddOnMini < Resource
|
4
|
+
|
5
|
+
# @!attribute accounting_code
|
6
|
+
# @return [String] Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code.
|
7
|
+
define_attribute :accounting_code, String
|
8
|
+
|
9
|
+
# @!attribute code
|
10
|
+
# @return [String] The unique identifier for the add-on within its plan.
|
11
|
+
define_attribute :code, String
|
12
|
+
|
13
|
+
# @!attribute [r] id
|
14
|
+
# @return [String] Add-on ID
|
15
|
+
define_attribute :id, String, {:read_only => true}
|
16
|
+
|
17
|
+
# @!attribute name
|
18
|
+
# @return [String] Describes your add-on and will appear in subscribers' invoices.
|
19
|
+
define_attribute :name, String
|
20
|
+
|
21
|
+
# @!attribute [r] object
|
22
|
+
# @return [String] Object type
|
23
|
+
define_attribute :object, String, {:read_only => true}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Resources
|
3
|
+
class CouponMini < Resource
|
4
|
+
|
5
|
+
# @!attribute code
|
6
|
+
# @return [String] The code the customer enters to redeem the coupon.
|
7
|
+
define_attribute :code, String
|
8
|
+
|
9
|
+
# @!attribute coupon_type
|
10
|
+
# @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.
|
11
|
+
define_attribute :coupon_type, String, {:enum => ["single_code", "bulk"]}
|
12
|
+
|
13
|
+
# @!attribute discount
|
14
|
+
# @return [CouponDiscount]
|
15
|
+
define_attribute :discount, :CouponDiscount
|
16
|
+
|
17
|
+
# @!attribute expired_at
|
18
|
+
# @return [DateTime] The date and time the coupon was expired early or reached its `max_redemptions`.
|
19
|
+
define_attribute :expired_at, DateTime
|
20
|
+
|
21
|
+
# @!attribute [r] id
|
22
|
+
# @return [String] Coupon ID
|
23
|
+
define_attribute :id, String, {:read_only => true}
|
24
|
+
|
25
|
+
# @!attribute name
|
26
|
+
# @return [String] The internal name for the coupon.
|
27
|
+
define_attribute :name, String
|
28
|
+
|
29
|
+
# @!attribute [r] object
|
30
|
+
# @return [String] Object type
|
31
|
+
define_attribute :object, String, {:read_only => true}
|
32
|
+
|
33
|
+
# @!attribute state
|
34
|
+
# @return [String] Indicates if the coupon is redeemable, and if it is not, why.
|
35
|
+
define_attribute :state, String, {:enum => ["redeemable", "maxed_out", "expired"]}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Resources
|
3
|
+
class CouponRedemptionMini < Resource
|
4
|
+
|
5
|
+
# @!attribute coupon
|
6
|
+
# @return [Coupon]
|
7
|
+
define_attribute :coupon, :Coupon
|
8
|
+
|
9
|
+
# @!attribute [r] created_at
|
10
|
+
# @return [DateTime] Created at
|
11
|
+
define_attribute :created_at, DateTime, {:read_only => true}
|
12
|
+
|
13
|
+
# @!attribute discounted
|
14
|
+
# @return [String] The amount that was discounted upon the application of the coupon, formatted with the currency.
|
15
|
+
define_attribute :discounted, String
|
16
|
+
|
17
|
+
# @!attribute [r] id
|
18
|
+
# @return [String] Coupon Redemption ID
|
19
|
+
define_attribute :id, String, {:read_only => true}
|
20
|
+
|
21
|
+
# @!attribute [r] object
|
22
|
+
# @return [String] Will always be `coupon`.
|
23
|
+
define_attribute :object, String, {:read_only => true}
|
24
|
+
|
25
|
+
# @!attribute state
|
26
|
+
# @return [String] Invoice state
|
27
|
+
define_attribute :state, String, {:enum => ["active", "inactive"]}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -3,8 +3,8 @@ module Recurly
|
|
3
3
|
class CreditPayment < Resource
|
4
4
|
|
5
5
|
# @!attribute account
|
6
|
-
# @return [
|
7
|
-
define_attribute :account, :
|
6
|
+
# @return [Account]
|
7
|
+
define_attribute :account, :Account
|
8
8
|
|
9
9
|
# @!attribute action
|
10
10
|
# @return [String] The action for which the credit was created.
|
@@ -15,8 +15,8 @@ module Recurly
|
|
15
15
|
define_attribute :amount, Float
|
16
16
|
|
17
17
|
# @!attribute applied_to_invoice
|
18
|
-
# @return [
|
19
|
-
define_attribute :applied_to_invoice, :
|
18
|
+
# @return [Invoice]
|
19
|
+
define_attribute :applied_to_invoice, :Invoice
|
20
20
|
|
21
21
|
# @!attribute [r] created_at
|
22
22
|
# @return [DateTime] Created at
|
@@ -39,8 +39,8 @@ module Recurly
|
|
39
39
|
define_attribute :original_credit_payment_id, String
|
40
40
|
|
41
41
|
# @!attribute original_invoice
|
42
|
-
# @return [
|
43
|
-
define_attribute :original_invoice, :
|
42
|
+
# @return [Invoice]
|
43
|
+
define_attribute :original_invoice, :Invoice
|
44
44
|
|
45
45
|
# @!attribute refund_transaction
|
46
46
|
# @return [Transaction]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Resources
|
3
|
+
class InvoiceMini < Resource
|
4
|
+
|
5
|
+
# @!attribute id
|
6
|
+
# @return [String] Invoice ID
|
7
|
+
define_attribute :id, String
|
8
|
+
|
9
|
+
# @!attribute number
|
10
|
+
# @return [String] Invoice number
|
11
|
+
define_attribute :number, String
|
12
|
+
|
13
|
+
# @!attribute object
|
14
|
+
# @return [String] Object type
|
15
|
+
define_attribute :object, String
|
16
|
+
|
17
|
+
# @!attribute state
|
18
|
+
# @return [String] Invoice state
|
19
|
+
define_attribute :state, String, {:enum => ["pending", "processing", "past_due", "paid", "failed"]}
|
20
|
+
|
21
|
+
# @!attribute type
|
22
|
+
# @return [String] Invoice type
|
23
|
+
define_attribute :type, String, {:enum => ["charge", "credit", "legacy"]}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -3,8 +3,8 @@ module Recurly
|
|
3
3
|
class LineItem < Resource
|
4
4
|
|
5
5
|
# @!attribute account
|
6
|
-
# @return [
|
7
|
-
define_attribute :account, :
|
6
|
+
# @return [Account]
|
7
|
+
define_attribute :account, :Account
|
8
8
|
|
9
9
|
# @!attribute accounting_code
|
10
10
|
# @return [String] Internal accounting code to help you reconcile your revenue to the correct ledger. Line items created as part of a subscription invoice will use the plan or add-on's accounting code, otherwise the value will only be present if you define an accounting code when creating the line item.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Resources
|
3
|
+
class PlanMini < Resource
|
4
|
+
|
5
|
+
# @!attribute code
|
6
|
+
# @return [String] Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports.
|
7
|
+
define_attribute :code, String
|
8
|
+
|
9
|
+
# @!attribute [r] id
|
10
|
+
# @return [String] Plan ID
|
11
|
+
define_attribute :id, String, {:read_only => true}
|
12
|
+
|
13
|
+
# @!attribute name
|
14
|
+
# @return [String] This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice.
|
15
|
+
define_attribute :name, String
|
16
|
+
|
17
|
+
# @!attribute [r] object
|
18
|
+
# @return [String] Object type
|
19
|
+
define_attribute :object, String, {:read_only => true}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -3,8 +3,8 @@ module Recurly
|
|
3
3
|
class Subscription < Resource
|
4
4
|
|
5
5
|
# @!attribute account
|
6
|
-
# @return [
|
7
|
-
define_attribute :account, :
|
6
|
+
# @return [Account]
|
7
|
+
define_attribute :account, :Account
|
8
8
|
|
9
9
|
# @!attribute activated_at
|
10
10
|
# @return [DateTime] Activated at
|
@@ -79,8 +79,8 @@ module Recurly
|
|
79
79
|
define_attribute :pending_change, :SubscriptionChange
|
80
80
|
|
81
81
|
# @!attribute plan
|
82
|
-
# @return [
|
83
|
-
define_attribute :plan, :
|
82
|
+
# @return [Plan]
|
83
|
+
define_attribute :plan, :Plan
|
84
84
|
|
85
85
|
# @!attribute po_number
|
86
86
|
# @return [String] For manual invoicing, this identifies the PO number associated with the subscription.
|
@@ -31,8 +31,8 @@ module Recurly
|
|
31
31
|
define_attribute :object, String
|
32
32
|
|
33
33
|
# @!attribute plan
|
34
|
-
# @return [
|
35
|
-
define_attribute :plan, :
|
34
|
+
# @return [Plan]
|
35
|
+
define_attribute :plan, :Plan
|
36
36
|
|
37
37
|
# @!attribute quantity
|
38
38
|
# @return [Integer] Subscription quantity
|
@@ -3,8 +3,8 @@ module Recurly
|
|
3
3
|
class Transaction < Resource
|
4
4
|
|
5
5
|
# @!attribute account
|
6
|
-
# @return [
|
7
|
-
define_attribute :account, :
|
6
|
+
# @return [Account]
|
7
|
+
define_attribute :account, :Account
|
8
8
|
|
9
9
|
# @!attribute amount
|
10
10
|
# @return [Float] Total transaction amount sent to the payment gateway.
|
@@ -71,8 +71,8 @@ module Recurly
|
|
71
71
|
define_attribute :id, String
|
72
72
|
|
73
73
|
# @!attribute invoice
|
74
|
-
# @return [
|
75
|
-
define_attribute :invoice, :
|
74
|
+
# @return [Invoice]
|
75
|
+
define_attribute :invoice, :Invoice
|
76
76
|
|
77
77
|
# @!attribute ip_address_country
|
78
78
|
# @return [String] IP address's country
|
@@ -139,8 +139,8 @@ module Recurly
|
|
139
139
|
define_attribute :voided_at, DateTime
|
140
140
|
|
141
141
|
# @!attribute voided_by_invoice
|
142
|
-
# @return [
|
143
|
-
define_attribute :voided_by_invoice, :
|
142
|
+
# @return [Invoice]
|
143
|
+
define_attribute :voided_by_invoice, :Invoice
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
data/lib/recurly/schema.rb
CHANGED
@@ -42,7 +42,9 @@ module Recurly
|
|
42
42
|
def self.get_recurly_class(type)
|
43
43
|
raise ArgumentError, "#{type.inspect} must be a symbol but is a #{type.class}" unless type.is_a?(Symbol)
|
44
44
|
|
45
|
-
if
|
45
|
+
if type == :Address
|
46
|
+
Resources::Address
|
47
|
+
elsif Requests.const_defined?(type)
|
46
48
|
Requests.const_get(type)
|
47
49
|
elsif Resources.const_defined?(type)
|
48
50
|
Resources.const_get(type)
|
@@ -100,6 +102,11 @@ module Recurly
|
|
100
102
|
def recurly_class
|
101
103
|
Schema.get_recurly_class(type == Array ? options[:item_type] : type)
|
102
104
|
end
|
105
|
+
|
106
|
+
def is_primitive?
|
107
|
+
t = type == Array ? options[:item_type] : type
|
108
|
+
t.is_a?(Class) || t == :Boolean
|
109
|
+
end
|
103
110
|
end
|
104
111
|
|
105
112
|
private_constant :List
|
@@ -20,21 +20,25 @@ module Recurly
|
|
20
20
|
attributes.each do |attr_name, val|
|
21
21
|
next if attr_name == 'object'
|
22
22
|
|
23
|
+
schema_attr = self.schema.get_attribute(attr_name)
|
24
|
+
|
23
25
|
# if the Hash val is a recurly type, parse it into a Resource
|
24
|
-
if val.is_a?(Hash) &&
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
26
|
+
val = if val.is_a?(Hash) && !schema_attr.is_primitive?
|
27
|
+
schema_attr.recurly_class.from_json(val)
|
28
|
+
elsif val.is_a?(Array)
|
29
|
+
val.map do |e|
|
30
|
+
if e.is_a?(Hash) && !schema_attr.is_primitive?
|
31
|
+
schema_attr.recurly_class.from_json(e)
|
32
|
+
else
|
33
|
+
e
|
34
|
+
end
|
35
|
+
end
|
36
|
+
elsif attr_name.end_with?("_at") && val && val.is_a?(String)
|
37
|
+
# TODO should use the schema to determine this probably
|
38
|
+
DateTime.parse(val)
|
39
|
+
else
|
40
|
+
val
|
41
|
+
end
|
38
42
|
|
39
43
|
writer = "#{attr_name}="
|
40
44
|
|
@@ -36,7 +36,7 @@ module Recurly
|
|
36
36
|
|
37
37
|
# Validates an individual attribute
|
38
38
|
def validate_attribute!(schema_attr, val)
|
39
|
-
|
39
|
+
unless schema_attr.type.is_a?(Symbol) || val.is_a?(schema_attr.type)
|
40
40
|
expected = case schema_attr.type
|
41
41
|
when Array
|
42
42
|
"Array of #{schema_attr.type.item_type}s"
|
data/lib/recurly/version.rb
CHANGED
data/recurly.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
# spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_dependency "faraday", "~> 0.
|
24
|
+
spec.add_dependency "faraday", "~> 0.12"
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.14"
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
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.0.0.beta.
|
4
|
+
version: 3.0.0.beta.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recurly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.12'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.12'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,20 +170,26 @@ files:
|
|
170
170
|
- lib/recurly/resources/account.rb
|
171
171
|
- lib/recurly/resources/account_acquisition.rb
|
172
172
|
- lib/recurly/resources/account_balance.rb
|
173
|
+
- lib/recurly/resources/account_mini.rb
|
173
174
|
- lib/recurly/resources/account_note.rb
|
174
175
|
- lib/recurly/resources/add_on.rb
|
176
|
+
- lib/recurly/resources/add_on_mini.rb
|
175
177
|
- lib/recurly/resources/address.rb
|
176
178
|
- lib/recurly/resources/billing_info.rb
|
177
179
|
- lib/recurly/resources/coupon.rb
|
178
180
|
- lib/recurly/resources/coupon_discount.rb
|
181
|
+
- lib/recurly/resources/coupon_mini.rb
|
179
182
|
- lib/recurly/resources/coupon_redemption.rb
|
183
|
+
- lib/recurly/resources/coupon_redemption_mini.rb
|
180
184
|
- lib/recurly/resources/credit_payment.rb
|
181
185
|
- lib/recurly/resources/error.rb
|
182
186
|
- lib/recurly/resources/error_may_have_transaction.rb
|
183
187
|
- lib/recurly/resources/invoice.rb
|
184
188
|
- lib/recurly/resources/invoice_collection.rb
|
189
|
+
- lib/recurly/resources/invoice_mini.rb
|
185
190
|
- lib/recurly/resources/line_item.rb
|
186
191
|
- lib/recurly/resources/plan.rb
|
192
|
+
- lib/recurly/resources/plan_mini.rb
|
187
193
|
- lib/recurly/resources/settings.rb
|
188
194
|
- lib/recurly/resources/shipping_address.rb
|
189
195
|
- lib/recurly/resources/site.rb
|