Class: Io::Flow::V0::Models::FieldValidationRequiredIfPresent

Inherits:
FieldValidationRule show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Indicates a field is required if it is presented in the user interface

Instance Attribute Summary collapse

Attributes inherited from FieldValidationRule

#discriminator

Instance Method Summary collapse

Methods inherited from FieldValidationRule

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ FieldValidationRequiredIfPresent

Returns a new instance of FieldValidationRequiredIfPresent.



43210
43211
43212
43213
43214
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43210

def initialize(incoming={})
  super(:discriminator => FieldValidationRule::Types::FIELD_VALIDATION_REQUIRED_IF_PRESENT)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @placeholder = (x = opts.delete(:placeholder); x.nil? ? nil : HttpClient::Preconditions.assert_class('placeholder', x, String))
end

Instance Attribute Details

#placeholderObject (readonly)

Returns the value of attribute placeholder.



43208
43209
43210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43208

def placeholder
  @placeholder
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



43220
43221
43222
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43220

def copy(incoming={})
  FieldValidationRequiredIfPresent.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



43224
43225
43226
43227
43228
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43224

def subtype_to_hash
  {
    :placeholder => placeholder
  }
end

#to_jsonObject



43216
43217
43218
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43216

def to_json
  JSON.dump(to_hash)
end