Class: AdvancedBilling::AgreementAcceptance

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/agreement_acceptance.rb

Overview

Required when creating a subscription with Maxio Payments.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(ip_address: SKIP, terms_url: SKIP, privacy_policy_url: SKIP, return_refund_policy_url: SKIP, delivery_policy_url: SKIP, secure_checkout_policy_url: SKIP, additional_properties: {}) ⇒ AgreementAcceptance

Returns a new instance of AgreementAcceptance.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 75

def initialize(ip_address: SKIP, terms_url: SKIP, privacy_policy_url: SKIP,
               return_refund_policy_url: SKIP, delivery_policy_url: SKIP,
               secure_checkout_policy_url: SKIP, additional_properties: {})
  @ip_address = ip_address unless ip_address == SKIP
  @terms_url = terms_url unless terms_url == SKIP
  @privacy_policy_url = privacy_policy_url unless privacy_policy_url == SKIP
  @return_refund_policy_url = return_refund_policy_url unless return_refund_policy_url == SKIP
  @delivery_policy_url = delivery_policy_url unless delivery_policy_url == SKIP
  unless secure_checkout_policy_url == SKIP
    @secure_checkout_policy_url =
      secure_checkout_policy_url
  end

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#delivery_policy_urlString

Required when creating a subscription with Maxio Payments. Either terms_url or provacy_policy_url required when providing agreement_acceptance params.

Returns:

  • (String)


38
39
40
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 38

def delivery_policy_url
  @delivery_policy_url
end

#ip_addressString

Required when providing agreement acceptance params.

Returns:

  • (String)


14
15
16
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 14

def ip_address
  @ip_address
end

#privacy_policy_urlString

Required when creating a subscription with Maxio Payments. Either terms_url or provacy_policy_url required when providing agreement_acceptance params.

Returns:

  • (String)


26
27
28
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 26

def privacy_policy_url
  @privacy_policy_url
end

#return_refund_policy_urlString

Required when creating a subscription with Maxio Payments. Either terms_url or provacy_policy_url required when providing agreement_acceptance params.

Returns:

  • (String)


32
33
34
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 32

def return_refund_policy_url
  @return_refund_policy_url
end

#secure_checkout_policy_urlString

Required when creating a subscription with Maxio Payments. Either terms_url or provacy_policy_url required when providing agreement_acceptance params.

Returns:

  • (String)


44
45
46
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 44

def secure_checkout_policy_url
  @secure_checkout_policy_url
end

#terms_urlString

Required when creating a subscription with Maxio Payments. Either terms_url or provacy_policy_url required when providing agreement_acceptance params.

Returns:

  • (String)


20
21
22
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 20

def terms_url
  @terms_url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ip_address = hash.key?('ip_address') ? hash['ip_address'] : SKIP
  terms_url = hash.key?('terms_url') ? hash['terms_url'] : SKIP
  privacy_policy_url =
    hash.key?('privacy_policy_url') ? hash['privacy_policy_url'] : SKIP
  return_refund_policy_url =
    hash.key?('return_refund_policy_url') ? hash['return_refund_policy_url'] : SKIP
  delivery_policy_url =
    hash.key?('delivery_policy_url') ? hash['delivery_policy_url'] : SKIP
  secure_checkout_policy_url =
    hash.key?('secure_checkout_policy_url') ? hash['secure_checkout_policy_url'] : SKIP

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  AgreementAcceptance.new(ip_address: ip_address,
                          terms_url: terms_url,
                          privacy_policy_url: privacy_policy_url,
                          return_refund_policy_url: return_refund_policy_url,
                          delivery_policy_url: delivery_policy_url,
                          secure_checkout_policy_url: secure_checkout_policy_url,
                          additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ip_address'] = 'ip_address'
  @_hash['terms_url'] = 'terms_url'
  @_hash['privacy_policy_url'] = 'privacy_policy_url'
  @_hash['return_refund_policy_url'] = 'return_refund_policy_url'
  @_hash['delivery_policy_url'] = 'delivery_policy_url'
  @_hash['secure_checkout_policy_url'] = 'secure_checkout_policy_url'
  @_hash
end

.nullablesObject

An array for nullable fields



71
72
73
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 71

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 59

def self.optionals
  %w[
    ip_address
    terms_url
    privacy_policy_url
    return_refund_policy_url
    delivery_policy_url
    secure_checkout_policy_url
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



125
126
127
128
129
130
131
# File 'lib/advanced_billing/models/agreement_acceptance.rb', line 125

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end