Class: Io::Flow::V0::Models::FieldValidationMax

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

Returns a new instance of FieldValidationMax.



33245
33246
33247
33248
33249
33250
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33245

def initialize(incoming={})
  super(:discriminator => FieldValidationRule::Types::FIELD_VALIDATION_MAX)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:length], 'FieldValidationMax')
  @length = HttpClient::Preconditions.assert_class('length', opts.delete(:length), Integer)
end

Instance Attribute Details

#lengthObject (readonly)

Returns the value of attribute length.



33243
33244
33245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33243

def length
  @length
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



33256
33257
33258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33256

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

#subtype_to_hashObject



33260
33261
33262
33263
33264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33260

def subtype_to_hash
  {
    :length => length
  }
end

#to_jsonObject



33252
33253
33254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33252

def to_json
  JSON.dump(to_hash)
end