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.



32020
32021
32022
32023
32024
32025
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32020

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.



32018
32019
32020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32018

def length
  @length
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32031
32032
32033
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32031

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

#subtype_to_hashObject



32035
32036
32037
32038
32039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32035

def subtype_to_hash
  {
    :length => length
  }
end

#to_jsonObject



32027
32028
32029
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32027

def to_json
  JSON.dump(to_hash)
end