Class: Io::Flow::V0::Models::FieldValidationPattern

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

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 = {}) ⇒ FieldValidationPattern

Returns a new instance of FieldValidationPattern.



30406
30407
30408
30409
30410
30411
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30406

def initialize(incoming={})
  super(:discriminator => FieldValidationRule::Types::FIELD_VALIDATION_PATTERN)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:pattern], 'FieldValidationPattern')
  @pattern = HttpClient::Preconditions.assert_class('pattern', opts.delete(:pattern), String)
end

Instance Attribute Details

#patternObject (readonly)

Returns the value of attribute pattern.



30404
30405
30406
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30404

def pattern
  @pattern
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30417
30418
30419
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30417

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

#subtype_to_hashObject



30421
30422
30423
30424
30425
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30421

def subtype_to_hash
  {
    :pattern => pattern
  }
end

#to_jsonObject



30413
30414
30415
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30413

def to_json
  JSON.dump(to_hash)
end