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.



33663
33664
33665
33666
33667
33668
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33663

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.



33661
33662
33663
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33661

def pattern
  @pattern
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



33674
33675
33676
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33674

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

#subtype_to_hashObject



33678
33679
33680
33681
33682
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33678

def subtype_to_hash
  {
    :pattern => pattern
  }
end

#to_jsonObject



33670
33671
33672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33670

def to_json
  JSON.dump(to_hash)
end