recurly 3.0.0.beta.5 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.bumpversion.cfg +12 -0
- data/.travis.yml +2 -2
- data/.yardopts +3 -0
- data/CONTRIBUTING.md +102 -0
- data/GETTING_STARTED.md +266 -0
- data/README.md +12 -194
- data/benchmark.rb +16 -0
- data/lib/recurly.rb +4 -7
- data/lib/recurly/client.rb +60 -60
- data/lib/recurly/client/operations.rb +498 -340
- data/lib/recurly/errors.rb +4 -0
- data/lib/recurly/http.rb +43 -0
- data/lib/recurly/pager.rb +4 -10
- data/lib/recurly/request.rb +6 -6
- data/lib/recurly/requests.rb +8 -0
- data/lib/recurly/requests/account_acquisition_updatable.rb +2 -2
- data/lib/recurly/requests/billing_info_create.rb +4 -0
- data/lib/recurly/requests/custom_field.rb +18 -0
- data/lib/recurly/requests/invoice_create.rb +0 -4
- data/lib/recurly/requests/invoice_refund.rb +2 -2
- data/lib/recurly/requests/line_item_create.rb +4 -0
- data/lib/recurly/requests/purchase_create.rb +3 -7
- data/lib/recurly/requests/shipping_fee_create.rb +22 -0
- data/lib/recurly/requests/shipping_purchase.rb +22 -0
- data/lib/recurly/requests/subscription_add_on_create.rb +2 -6
- data/lib/recurly/requests/subscription_add_on_update.rb +26 -0
- data/lib/recurly/requests/subscription_change_create.rb +7 -3
- data/lib/recurly/requests/subscription_change_shipping_create.rb +22 -0
- data/lib/recurly/requests/subscription_create.rb +4 -8
- data/lib/recurly/requests/subscription_shipping_create.rb +30 -0
- data/lib/recurly/requests/subscription_shipping_update.rb +22 -0
- data/lib/recurly/requests/subscription_update.rb +3 -7
- data/lib/recurly/resource.rb +14 -1
- data/lib/recurly/resources.rb +17 -0
- data/lib/recurly/resources/account_acquisition.rb +2 -2
- data/lib/recurly/resources/add_on.rb +1 -1
- data/lib/recurly/resources/billing_info.rb +6 -6
- data/lib/recurly/resources/coupon.rb +1 -1
- data/lib/recurly/resources/coupon_discount.rb +2 -2
- data/lib/recurly/resources/coupon_redemption.rb +2 -2
- data/lib/recurly/resources/coupon_redemption_mini.rb +2 -2
- data/lib/recurly/resources/error_may_have_transaction.rb +2 -2
- data/lib/recurly/resources/invoice.rb +4 -0
- data/lib/recurly/resources/line_item.rb +1 -1
- data/lib/recurly/resources/{billing_info_payment_method.rb → payment_method.rb} +18 -2
- data/lib/recurly/resources/plan.rb +1 -1
- data/lib/recurly/resources/shipping_method.rb +42 -0
- data/lib/recurly/resources/shipping_method_mini.rb +26 -0
- data/lib/recurly/resources/subscription.rb +3 -3
- data/lib/recurly/resources/subscription_change.rb +4 -0
- data/lib/recurly/resources/subscription_shipping.rb +26 -0
- data/lib/recurly/resources/transaction.rb +4 -4
- data/lib/recurly/resources/transaction_error.rb +30 -0
- data/lib/recurly/schema.rb +85 -49
- data/lib/recurly/schema/json_parser.rb +16 -8
- data/lib/recurly/schema/request_caster.rb +10 -16
- data/lib/recurly/schema/resource_caster.rb +48 -0
- data/lib/recurly/schema/schema_factory.rb +0 -2
- data/lib/recurly/schema/schema_validator.rb +11 -14
- data/lib/recurly/version.rb +1 -1
- data/recurly.gemspec +6 -6
- data/scripts/build +1 -0
- data/scripts/bump +4 -0
- data/scripts/format +2 -0
- data/scripts/release +11 -0
- data/scripts/test +1 -0
- metadata +38 -20
- data/.ruby-version +0 -1
- data/lib/recurly/resources/transaction_payment_method.rb +0 -34
- data/lib/recurly/schema/json_deserializer.rb +0 -56
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.4.5
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# This file is automatically created by Recurly's OpenAPI generation process
|
2
|
-
# and thus any edits you make by hand will be lost. If you wish to make a
|
3
|
-
# change to this file, please create a Github issue explaining the changes you
|
4
|
-
# need and we will usher them to the appropriate places.
|
5
|
-
module Recurly
|
6
|
-
module Resources
|
7
|
-
class TransactionPaymentMethod < Resource
|
8
|
-
|
9
|
-
# @!attribute card_type
|
10
|
-
# @return [String] Visa, MasterCard, American Express, Discover, JCB, etc.
|
11
|
-
define_attribute :card_type, String
|
12
|
-
|
13
|
-
# @!attribute exp_month
|
14
|
-
# @return [Integer] Expiration month.
|
15
|
-
define_attribute :exp_month, Integer
|
16
|
-
|
17
|
-
# @!attribute exp_year
|
18
|
-
# @return [Integer] Expiration year.
|
19
|
-
define_attribute :exp_year, Integer
|
20
|
-
|
21
|
-
# @!attribute first_six
|
22
|
-
# @return [String] Credit card number's first six digits.
|
23
|
-
define_attribute :first_six, String
|
24
|
-
|
25
|
-
# @!attribute last_four
|
26
|
-
# @return [String] Credit card number's last four digits.
|
27
|
-
define_attribute :last_four, String
|
28
|
-
|
29
|
-
# @!attribute object
|
30
|
-
# @return [String]
|
31
|
-
define_attribute :object, String
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require "date"
|
2
|
-
|
3
|
-
module Recurly
|
4
|
-
class Schema
|
5
|
-
# The purpose of this class is to turn Recurly defined
|
6
|
-
# JSON data into Recurly ruby objects. It's to be used
|
7
|
-
# by the Resource as an extension.
|
8
|
-
module JsonDeserializer
|
9
|
-
# Gives the class the ability to initialize itself
|
10
|
-
# given some json data.
|
11
|
-
#
|
12
|
-
# @example
|
13
|
-
# Recurly::Resources::Account.from_json({"code" => "mycode"})
|
14
|
-
# #=> #<Recurly::Resources::Account @attributes={:code=>"mycode"}>
|
15
|
-
#
|
16
|
-
# @param attributes [Hash] A primitive Hash from JSON.parse of Recurly result.
|
17
|
-
# @return [Resource] the {Resource} (ruby object) representing the passed in JSON data.
|
18
|
-
def from_json(attributes = {})
|
19
|
-
resource = new()
|
20
|
-
attributes.each do |attr_name, val|
|
21
|
-
next if attr_name == "object"
|
22
|
-
|
23
|
-
schema_attr = self.schema.get_attribute(attr_name)
|
24
|
-
|
25
|
-
if schema_attr
|
26
|
-
# if the Hash val is a recurly type, parse it into a Resource
|
27
|
-
val = if val.is_a?(Hash) && !schema_attr.is_primitive?
|
28
|
-
schema_attr.recurly_class.from_json(val)
|
29
|
-
elsif val.is_a?(Array)
|
30
|
-
val.map do |e|
|
31
|
-
if e.is_a?(Hash) && !schema_attr.is_primitive?
|
32
|
-
schema_attr.recurly_class.from_json(e)
|
33
|
-
else
|
34
|
-
e
|
35
|
-
end
|
36
|
-
end
|
37
|
-
elsif val && schema_attr.type == DateTime && val.is_a?(String)
|
38
|
-
DateTime.parse(val)
|
39
|
-
else
|
40
|
-
val
|
41
|
-
end
|
42
|
-
|
43
|
-
writer = "#{attr_name}="
|
44
|
-
|
45
|
-
resource.send(writer, val)
|
46
|
-
else
|
47
|
-
if Recurly::STRICT_MODE
|
48
|
-
raise ArgumentError, "#{resource.class.name} encountered json attribute #{attr_name.inspect}: #{val.inspect} but it's unknown to it's schema"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
resource
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|