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.



43155
43156
43157
43158
43159
43160
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43155

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.



43153
43154
43155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43153

def pattern
  @pattern
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



43166
43167
43168
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43166

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

#subtype_to_hashObject



43170
43171
43172
43173
43174
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43170

def subtype_to_hash
  {
    :pattern => pattern
  }
end

#to_jsonObject



43162
43163
43164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43162

def to_json
  JSON.dump(to_hash)
end