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.



32748
32749
32750
32751
32752
32753
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32748

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.



32746
32747
32748
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32746

def pattern
  @pattern
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32759
32760
32761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32759

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

#subtype_to_hashObject



32763
32764
32765
32766
32767
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32763

def subtype_to_hash
  {
    :pattern => pattern
  }
end

#to_jsonObject



32755
32756
32757
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32755

def to_json
  JSON.dump(to_hash)
end