six_saferpay 2.3.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +4 -2
  4. data/Gemfile.lock +77 -82
  5. data/README.md +3 -2
  6. data/Thorfile +1 -0
  7. data/lib/generators/models.rb +100 -0
  8. data/lib/generators/templates/fabric.erb +13 -0
  9. data/lib/generators/templates/model.erb +64 -0
  10. data/lib/generators/templates/spec.erb +24 -0
  11. data/lib/six_saferpay.rb +5 -0
  12. data/lib/six_saferpay/api.rb +1 -1
  13. data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +14 -2
  14. data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +17 -2
  15. data/lib/six_saferpay/api/six_secure_card_data/requests/insert.rb +6 -2
  16. data/lib/six_saferpay/api/six_secure_card_data/responses/insert_response.rb +9 -4
  17. data/lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb +6 -2
  18. data/lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb +11 -2
  19. data/lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb +4 -0
  20. data/lib/six_saferpay/api/six_transaction/requests/authorize_referenced.rb +4 -0
  21. data/lib/six_saferpay/api/six_transaction/requests/capture.rb +11 -2
  22. data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +14 -2
  23. data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +11 -2
  24. data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +17 -3
  25. data/lib/six_saferpay/models/authentication.rb +36 -0
  26. data/lib/six_saferpay/models/authentication_result.rb +20 -0
  27. data/lib/six_saferpay/models/card_form.rb +11 -2
  28. data/lib/six_saferpay/models/check_result.rb +6 -2
  29. data/lib/six_saferpay/models/chosen_plan.rb +62 -0
  30. data/lib/six_saferpay/models/custom_plan.rb +4 -0
  31. data/lib/six_saferpay/models/first_installment_amount.rb +4 -0
  32. data/lib/six_saferpay/models/fraud_prevention.rb +24 -0
  33. data/lib/six_saferpay/models/installment_fee.rb +4 -0
  34. data/lib/six_saferpay/models/installment_plans.rb +73 -0
  35. data/lib/six_saferpay/models/items.rb +84 -0
  36. data/lib/six_saferpay/models/mastercard_issuer_installments.rb +49 -0
  37. data/lib/six_saferpay/models/order.rb +27 -0
  38. data/lib/six_saferpay/models/payer.rb +8 -2
  39. data/lib/six_saferpay/models/payer_profile.rb +105 -0
  40. data/lib/six_saferpay/models/phone.rb +36 -0
  41. data/lib/six_saferpay/models/registration_result.rb +11 -2
  42. data/lib/six_saferpay/models/risk_factors.rb +39 -0
  43. data/lib/six_saferpay/models/subsequent_installment_amount.rb +4 -0
  44. data/lib/six_saferpay/models/total_amont_due.rb +4 -0
  45. data/lib/six_saferpay/version.rb +1 -1
  46. data/six_saferpay.gemspec +9 -8
  47. metadata +58 -24
data/lib/six_saferpay.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'active_support/core_ext/hash'
2
2
  require 'active_support/core_ext/string'
3
+ require 'active_support/inflector'
3
4
  require 'securerandom'
4
5
  require 'json'
5
6
  require 'net/http'
@@ -12,6 +13,10 @@ Dir[File.join(gem_root, "lib", "six_saferpay", "**/*.rb")].sort.each do |file|
12
13
  require file
13
14
  end
14
15
 
16
+ Dir[File.join(gem_root, "lib", "generators", "**/*.thor")].sort.each do |file|
17
+ require file
18
+ end
19
+
15
20
  module SixSaferpay
16
21
 
17
22
  class Config
@@ -1,5 +1,5 @@
1
1
  module SixSaferpay
2
2
  module API
3
- VERSION = '1.15'
3
+ VERSION = '1.19'
4
4
  end
5
5
  end
@@ -9,6 +9,7 @@ module SixSaferpay
9
9
  :payment,
10
10
  :payment_methods,
11
11
  :payment_methods_options,
12
+ :authentication,
12
13
  :wallets,
13
14
  :payer,
14
15
  :register_alias,
@@ -18,7 +19,9 @@ module SixSaferpay
18
19
  :billing_address_form,
19
20
  :delivery_address_form,
20
21
  :card_form,
21
- :condition
22
+ :condition,
23
+ :order,
24
+ :risk_factors
22
25
  )
23
26
 
24
27
  def initialize(request_header: nil,
@@ -27,6 +30,7 @@ module SixSaferpay
27
30
  payment:,
28
31
  payment_methods: nil,
29
32
  payment_methods_options: nil,
33
+ authentication: nil,
30
34
  wallets: nil,
31
35
  payer: nil,
32
36
  register_alias: nil,
@@ -36,7 +40,9 @@ module SixSaferpay
36
40
  billing_address_form: nil,
37
41
  delivery_address_form: nil,
38
42
  card_form: nil,
39
- condition: nil
43
+ condition: nil,
44
+ order: nil,
45
+ risk_factors: nil
40
46
  )
41
47
  @request_header = request_header || SixSaferpay::RequestHeader.new()
42
48
  @config_set = config_set
@@ -44,6 +50,7 @@ module SixSaferpay
44
50
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
45
51
  @payment_methods = payment_methods
46
52
  @payment_methods_options = SixSaferpay::PaymentMethodsOptions.new(payment_methods_options.to_h) if payment_methods_options
53
+ @authentication = SixSaferpay::Authentication.new(authentication.to_h) if authentication
47
54
  @wallets = wallets
48
55
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
49
56
  @register_alias = SixSaferpay::RegisterAlias.new(register_alias.to_h) if register_alias
@@ -54,6 +61,8 @@ module SixSaferpay
54
61
  @delivery_address_form = SixSaferpay::DeliveryAddressForm.new(delivery_address_form.to_h) if delivery_address_form
55
62
  @card_form = SixSaferpay::CardForm.new(card_form.to_h) if card_form
56
63
  @condition = condition
64
+ @order = SixSaferpay::Order.new(order.to_h) if order
65
+ @risk_factors = SixSaferpay::RiskFactors.new(risk_factors.to_h) if risk_factors
57
66
  end
58
67
 
59
68
  def to_hash
@@ -64,6 +73,7 @@ module SixSaferpay
64
73
  hash.merge!(payment: @payment.to_h)
65
74
  hash.merge!(payment_methods: @payment_methods) if @payment_methods
66
75
  hash.merge!(payment_methods_options: @payment_methods_options.to_h) if @payment_methods_options
76
+ hash.merge!(authentication: @authentication.to_h) if @authentication
67
77
  hash.merge!(wallets: @wallets) if @wallets
68
78
  hash.merge!(payer: @payer.to_h) if @payer
69
79
  hash.merge!(register_alias: @register_alias.to_h) if @register_alias
@@ -74,6 +84,8 @@ module SixSaferpay
74
84
  hash.merge!(delivery_address_form: @delivery_address_form.to_h) if @delivery_address_form
75
85
  hash.merge!(card_form: @card_form.to_h) if @card_form
76
86
  hash.merge!(condition: @condition) if @condition
87
+ hash.merge!(order: @order.to_h) if @order
88
+ hash.merge!(risk_factors: @risk_factors.to_h) if @risk_factors
77
89
  hash
78
90
  end
79
91
  alias_method :to_h, :to_hash
@@ -8,7 +8,9 @@ module SixSaferpay
8
8
  :payer,
9
9
  :registration_result,
10
10
  :liability,
11
- :dcc
11
+ :dcc,
12
+ :mastercard_issuer_installments,
13
+ :fraud_prevention,
12
14
  )
13
15
 
14
16
  def initialize(response_header:,
@@ -17,7 +19,9 @@ module SixSaferpay
17
19
  payer: nil,
18
20
  registration_result: nil,
19
21
  liability: nil,
20
- dcc: nil
22
+ dcc: nil,
23
+ mastercard_issuer_installments: nil,
24
+ fraud_prevention: nil
21
25
  )
22
26
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h)
23
27
  @transaction = SixSaferpay::Transaction.new(transaction.to_h)
@@ -26,6 +30,11 @@ module SixSaferpay
26
30
  @registration_result = SixSaferpay::RegistrationResult.new(registration_result.to_h) if registration_result
27
31
  @liability = SixSaferpay::Liability.new(liability.to_h) if liability
28
32
  @dcc = SixSaferpay::Dcc.new(dcc.to_h) if dcc
33
+ if mastercard_issuer_installments
34
+ @mastercard_issuer_installments = SixSaferpay::MastercardIssuerInstallments
35
+ .new(mastercard_issuer_installments.to_h)
36
+ end
37
+ @fraud_prevention = SixSaferpay::FraudPrevention.new(fraud_prevention.to_h) if fraud_prevention
29
38
  end
30
39
 
31
40
  def to_hash
@@ -37,6 +46,12 @@ module SixSaferpay
37
46
  hash.merge!(registration_result: @registration_result.to_h) if @registration_result
38
47
  hash.merge!(liability: @liability.to_h) if @liability
39
48
  hash.merge!(dcc: @dcc.to_h) if @dcc
49
+ if @mastercard_issuer_installments
50
+ hash.merge!(mastercard_issuer_installments: mastercard_issuer_installments.to_h)
51
+ end
52
+ if @fraud_prevention
53
+ hash.merge!(fraud_prevention: fraud_prevention.to_h)
54
+ end
40
55
  hash
41
56
  end
42
57
  alias_method :to_h, :to_hash
@@ -10,7 +10,8 @@ module SixSaferpay
10
10
  :language_code,
11
11
  :check,
12
12
  :payment_methods,
13
- :card_form
13
+ :card_form,
14
+ :payment_means
14
15
  )
15
16
 
16
17
  def initialize(request_header: nil,
@@ -21,7 +22,8 @@ module SixSaferpay
21
22
  language_code: nil,
22
23
  check: nil,
23
24
  payment_methods: nil,
24
- card_form: nil
25
+ card_form: nil,
26
+ payment_means: nil
25
27
  )
26
28
  @request_header = request_header || SixSaferpay::RequestHeader.new()
27
29
  @register_alias = SixSaferpay::RegisterAlias.new(register_alias.to_h) if register_alias
@@ -32,6 +34,7 @@ module SixSaferpay
32
34
  @check = SixSaferpay::Check.new(check.to_h) if check
33
35
  @payment_methods = payment_methods
34
36
  @card_form = SixSaferpay::CardForm.new(card_form.to_h) if card_form
37
+ @payment_means = SixSaferpay::RequestPaymentMeans.new(payment_means.to_h) if payment_means
35
38
  end
36
39
 
37
40
  def to_hash
@@ -45,6 +48,7 @@ module SixSaferpay
45
48
  hash.merge!(check: @check.to_h) if @check
46
49
  hash.merge!(payment_methods: @payment_methods) if @payment_methods
47
50
  hash.merge!(card_form: @card_form.to_h) if @card_form
51
+ hash.merge!(payment_means: @payment_means.to_h) if @payment_means
48
52
  hash
49
53
  end
50
54
  alias_method :to_h, :to_hash
@@ -5,17 +5,21 @@ module SixSaferpay
5
5
  attr_accessor(:response_header,
6
6
  :token,
7
7
  :expiration,
8
- :redirect_url
8
+ :redirect_required,
9
+ :redirect
9
10
  )
10
11
 
11
12
  def initialize(response_header:,
12
13
  token:,
13
14
  expiration:,
14
- redirect_url: )
15
+ redirect_required:,
16
+ redirect:
17
+ )
15
18
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
16
19
  @token = token
17
20
  @expiration = expiration
18
- @redirect_url = redirect_url
21
+ @redirect_required = redirect_required
22
+ @redirect = SixSaferpay::Redirect.new(redirect.to_h) if redirect
19
23
  end
20
24
 
21
25
  def to_hash
@@ -23,7 +27,8 @@ module SixSaferpay
23
27
  hash.merge!(response_header: @response_header.to_h) if @response_header
24
28
  hash.merge!(token: @token) if @token
25
29
  hash.merge!(expiration: @expiration) if @expiration
26
- hash.merge!(redirect_url: @redirect_url) if @redirect_url
30
+ hash.merge!(redirect_required: @redirect_required) if !@redirect_required.nil?
31
+ hash.merge!(redirect: @redirect.to_h) if @redirect
27
32
  hash
28
33
  end
29
34
  alias_method :to_h, :to_hash
@@ -6,14 +6,16 @@ module SixSaferpay
6
6
  :expiration_date,
7
7
  :config_set,
8
8
  :payer,
9
- :billing_address_form
9
+ :billing_address_form,
10
+ :register_alias,
10
11
  )
11
12
 
12
13
  def initialize(payment: ,
13
14
  expiration_date: ,
14
15
  config_set: nil,
15
16
  payer: ,
16
- billing_address_form: nil
17
+ billing_address_form: nil,
18
+ register_alias: nil
17
19
  )
18
20
 
19
21
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
@@ -22,6 +24,7 @@ module SixSaferpay
22
24
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
23
25
  @billing_address_form =
24
26
  SixSaferpay::BillingAddressForm.new(billing_address_form) if billing_address_form
27
+ @register_alias = SixSaferpay::RegisterAlias.new(register_alias.to_h) if register_alias
25
28
  end
26
29
 
27
30
  def to_hash
@@ -31,6 +34,7 @@ module SixSaferpay
31
34
  hash.merge!(config_set: @config_set) if @config_set
32
35
  hash.merge!(payer: @payer.to_h) if @payer
33
36
  hash.merge!(billing_address_form: @billing_address_form.to_h) if @billing_address_form
37
+ hash.merge!(register_alias: @register_alias.to_h) if @register_alias
34
38
  hash
35
39
  end
36
40
  alias_method :to_h, :to_hash
@@ -8,7 +8,9 @@ module SixSaferpay
8
8
  :payment_method,
9
9
  :payment_method_options,
10
10
  :payer,
11
- :notification
11
+ :notification,
12
+ :order,
13
+ :risk_factors,
12
14
  )
13
15
 
14
16
 
@@ -19,7 +21,10 @@ module SixSaferpay
19
21
  payment_method:,
20
22
  payment_method_options: nil,
21
23
  payer: nil,
22
- notification: )
24
+ notification:,
25
+ order: nil,
26
+ risk_factors: nil
27
+ )
23
28
  @request_header = request_header || SixSaferpay::RequestHeader.new()
24
29
  @terminal_id = terminal_id
25
30
  @payment = SixSaferpay::Payment.new(payment.to_h)
@@ -27,6 +32,8 @@ module SixSaferpay
27
32
  @payment_method_options = SixSaferpay::PaymentMethodOptions.new(payment_method_options.to_h) if payment_method_options
28
33
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
29
34
  @notification = SixSaferpay::Notification.new(notification.to_h)
35
+ @order = SixSaferpay::Order.new(order.to_h) if order
36
+ @risk_factors = SixSaferpay::RiskFactors.new(risk_factors.to_h) if risk_factors
30
37
  end
31
38
 
32
39
  def to_hash
@@ -38,6 +45,8 @@ module SixSaferpay
38
45
  hash.merge!(payment_method_options: @payment_method_options.to_h) if @payment_method_options
39
46
  hash.merge!(payer: @payer.to_h) if @payer
40
47
  hash.merge!(notification: @notification.to_h)
48
+ hash.merge!(order: @order.to_h) if @order
49
+ hash.merge!(risk_factors: @risk_factors.to_h) if @risk_factors
41
50
  hash
42
51
  end
43
52
  alias_method :to_h, :to_hash
@@ -6,6 +6,7 @@ module SixSaferpay
6
6
  :terminal_id,
7
7
  :payment,
8
8
  :payment_means,
9
+ :authentication,
9
10
  :register_alias,
10
11
  :payer
11
12
  )
@@ -15,6 +16,7 @@ module SixSaferpay
15
16
  terminal_id: nil,
16
17
  payment:,
17
18
  payment_means:,
19
+ authentication: nil,
18
20
  register_alias: nil,
19
21
  payer: nil
20
22
  )
@@ -22,6 +24,7 @@ module SixSaferpay
22
24
  @terminal_id = SixSaferpay.config.terminal_id || terminal_id
23
25
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
24
26
  @payment_means = SixSaferpay::RequestPaymentMeans.new(payment_means.to_h) if payment_means
27
+ @authentication = SixSaferpay::Authentication.new(authentication.to_h) if authentication
25
28
  @register_alias = SixSaferpay::RegisterAlias.new(register_alias.to_h) if register_alias
26
29
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
27
30
  end
@@ -32,6 +35,7 @@ module SixSaferpay
32
35
  hash.merge!(terminal_id: @terminal_id) if @terminal_id
33
36
  hash.merge!(payment: @payment.to_h) if @payment
34
37
  hash.merge!(payment_means: @payment_means.to_h) if @payment_means
38
+ hash.merge!(authentication: @authentication.to_h) if @authentication
35
39
  hash.merge!(register_alias: @register_alias.to_h) if @register_alias
36
40
  hash.merge!(payer: @payer.to_h) if @payer
37
41
  hash
@@ -6,6 +6,7 @@ module SixSaferpay
6
6
  :terminal_id,
7
7
  :payment,
8
8
  :transaction_reference,
9
+ :authentication,
9
10
  :suppress_dcc
10
11
  )
11
12
 
@@ -14,12 +15,14 @@ module SixSaferpay
14
15
  terminal_id: nil,
15
16
  payment:,
16
17
  transaction_reference:,
18
+ authentication: nil,
17
19
  suppress_dcc:
18
20
  )
19
21
  @request_header = request_header || SixSaferpay::RequestHeader.new()
20
22
  @terminal_id = terminal_id || SixSaferpay.config.terminal_id
21
23
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
22
24
  @transaction_reference = SixSaferpay::TransactionReference.new(transaction_reference.to_h) if transaction_reference
25
+ @authentication = SixSaferpay::Authentication.new(authentication.to_h) if authentication
23
26
  @suppress_dcc = suppress_dcc
24
27
  end
25
28
 
@@ -29,6 +32,7 @@ module SixSaferpay
29
32
  hash.merge!(terminal_id: @terminal_id) if @terminal_id
30
33
  hash.merge!(payment: @payment.to_h) if @payment
31
34
  hash.merge!(transaction_reference: @transaction_reference.to_h) if @transaction_reference
35
+ hash.merge!(authentication: @authentication.to_h) if @authentication
32
36
  hash.merge!(suppress_dcc: @suppress_dcc) if !@suppress_dcc.nil?
33
37
  hash
34
38
  end
@@ -7,7 +7,8 @@ module SixSaferpay
7
7
  :amount,
8
8
  :billpay,
9
9
  :pending_notification,
10
- :marketplace
10
+ :marketplace,
11
+ :mastercard_issuer_installments
11
12
  )
12
13
 
13
14
 
@@ -16,7 +17,8 @@ module SixSaferpay
16
17
  amount: nil,
17
18
  billpay: nil,
18
19
  pending_notification: nil,
19
- marketplace: nil
20
+ marketplace: nil,
21
+ mastercard_issuer_installments: nil
20
22
  )
21
23
  @request_header = request_header || SixSaferpay::RequestHeader.new()
22
24
  @transaction_reference = SixSaferpay::TransactionReference.new(transaction_reference.to_h) if transaction_reference
@@ -24,6 +26,10 @@ module SixSaferpay
24
26
  @billpay = SixSaferpay::Billpay.new(billpay.to_h) if billpay
25
27
  @pending_notification = SixSaferpay::PendingNotification.new(pending_notification.to_h) if pending_notification
26
28
  @marketplace = SixSaferpay::Marketplace.new(marketplace.to_h) if marketplace
29
+ if mastercard_issuer_installments
30
+ @mastercard_issuer_installments = SixSaferpay::MastercardIssuerInstallments
31
+ .new(mastercard_issuer_installments.to_h)
32
+ end
27
33
  end
28
34
 
29
35
  def to_hash
@@ -34,6 +40,9 @@ module SixSaferpay
34
40
  hash.merge!(billpay: @billpay.to_h) if @billpay
35
41
  hash.merge!(pending_notification: @pending_notification.to_h) if @pending_notification
36
42
  hash.merge!(marketplace: @marketplace.to_h) if @marketplace
43
+ if @mastercard_issuer_installments
44
+ hash.merge!(mastercard_issuer_installments: mastercard_issuer_installments.to_h)
45
+ end
37
46
  hash
38
47
  end
39
48
  alias_method :to_h, :to_hash
@@ -8,12 +8,15 @@ module SixSaferpay
8
8
  :terminal_id,
9
9
  :payment,
10
10
  :payment_means,
11
+ :authentication,
11
12
  :payer,
12
13
  :return_urls,
13
14
  :styling,
14
15
  :wallet,
15
16
  :payment_methods,
16
- :card_form
17
+ :card_form,
18
+ :order,
19
+ :risk_factors
17
20
  )
18
21
 
19
22
 
@@ -22,24 +25,30 @@ module SixSaferpay
22
25
  terminal_id: nil,
23
26
  payment:,
24
27
  payment_means: nil,
28
+ authentication: nil,
25
29
  payer: nil,
26
30
  return_urls: nil,
27
31
  styling: nil,
28
32
  wallet: nil,
29
33
  payment_methods: nil,
30
- card_form: nil
34
+ card_form: nil,
35
+ order: nil,
36
+ risk_factors: nil
31
37
  )
32
38
  @request_header = request_header || SixSaferpay::RequestHeader.new()
33
39
  @config_set = config_set
34
40
  @terminal_id = terminal_id || SixSaferpay.config.terminal_id
35
41
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
36
42
  @payment_means = SixSaferpay::RequestPaymentMeans.new(payment_means.to_h) if payment_means
43
+ @authentication = SixSaferpay::Authentication.new(authentication.to_h) if authentication
37
44
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
38
45
  @return_urls = return_urls || SixSaferpay::ReturnUrls.new()
39
46
  @styling = SixSaferpay::Styling.new(styling.to_h) if styling
40
47
  @wallet = SixSaferpay::Wallet.new(wallet.to_h) if wallet
41
48
  @payment_methods = payment_methods
42
49
  @card_form = SixSaferpay::CardForm.new(card_form.to_h) if card_form
50
+ @order = SixSaferpay::Order.new(order.to_h) if order
51
+ @risk_factors = SixSaferpay::RiskFactors.new(risk_factors.to_h) if risk_factors
43
52
  end
44
53
 
45
54
  def to_hash
@@ -49,12 +58,15 @@ module SixSaferpay
49
58
  hash.merge!(terminal_id: @terminal_id) if @terminal_id
50
59
  hash.merge!(payment: @payment.to_h) if @payment
51
60
  hash.merge!(payment_means: @payment_means.to_h) if @payment_means
61
+ hash.merge!(authentication: @authentication.to_h) if @authentication
52
62
  hash.merge!(payer: @payer.to_h) if @payer
53
63
  hash.merge!(return_urls: @return_urls.to_h ) if @return_urls
54
64
  hash.merge!(styling: @styling.to_h) if @styling
55
65
  hash.merge!(wallet: @wallet.to_h) if @wallet
56
66
  hash.merge!(payment_methods: @payment_methods) if @payment_methods
57
67
  hash.merge!(card_form: @card_form.to_h) if @card_form
68
+ hash.merge!(order: @order.to_h) if @order
69
+ hash.merge!(risk_factors: @risk_factors.to_h) if @risk_factors
58
70
  hash
59
71
  end
60
72
  alias_method :to_h, :to_hash