Class: Io::Flow::V0::Models::AddressFieldValidation

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AddressFieldValidation

Returns a new instance of AddressFieldValidation.



19676
19677
19678
19679
19680
19681
19682
19683
19684
19685
19686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19676

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @first_name = HttpClient::Preconditions.assert_class('first_name', (x = opts.delete(:first_name); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FieldValidationRule) ? x : ::Io::Flow::V0::Models::FieldValidationRule.from_json(x)) }
  @last_name = HttpClient::Preconditions.assert_class('last_name', (x = opts.delete(:last_name); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FieldValidationRule) ? x : ::Io::Flow::V0::Models::FieldValidationRule.from_json(x)) }
  @street_1 = HttpClient::Preconditions.assert_class('street_1', (x = opts.delete(:street_1); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FieldValidationRule) ? x : ::Io::Flow::V0::Models::FieldValidationRule.from_json(x)) }
  @street_2 = HttpClient::Preconditions.assert_class('street_2', (x = opts.delete(:street_2); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FieldValidationRule) ? x : ::Io::Flow::V0::Models::FieldValidationRule.from_json(x)) }
  @city = HttpClient::Preconditions.assert_class('city', (x = opts.delete(:city); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FieldValidationRule) ? x : ::Io::Flow::V0::Models::FieldValidationRule.from_json(x)) }
  @province = HttpClient::Preconditions.assert_class('province', (x = opts.delete(:province); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FieldValidationRule) ? x : ::Io::Flow::V0::Models::FieldValidationRule.from_json(x)) }
  @postal = HttpClient::Preconditions.assert_class('postal', (x = opts.delete(:postal); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FieldValidationRule) ? x : ::Io::Flow::V0::Models::FieldValidationRule.from_json(x)) }
  @phone = HttpClient::Preconditions.assert_class('phone', (x = opts.delete(:phone); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FieldValidationRule) ? x : ::Io::Flow::V0::Models::FieldValidationRule.from_json(x)) }
end

Instance Attribute Details

#cityObject (readonly)

Returns the value of attribute city.



19674
19675
19676
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19674

def city
  @city
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



19674
19675
19676
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19674

def first_name
  @first_name
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



19674
19675
19676
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19674

def last_name
  @last_name
end

#phoneObject (readonly)

Returns the value of attribute phone.



19674
19675
19676
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19674

def phone
  @phone
end

#postalObject (readonly)

Returns the value of attribute postal.



19674
19675
19676
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19674

def postal
  @postal
end

#provinceObject (readonly)

Returns the value of attribute province.



19674
19675
19676
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19674

def province
  @province
end

#street_1Object (readonly)

Returns the value of attribute street_1.



19674
19675
19676
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19674

def street_1
  @street_1
end

#street_2Object (readonly)

Returns the value of attribute street_2.



19674
19675
19676
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19674

def street_2
  @street_2
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19692
19693
19694
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19692

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

#to_hashObject



19696
19697
19698
19699
19700
19701
19702
19703
19704
19705
19706
19707
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19696

def to_hash
  {
    :first_name => first_name.map { |o| o.to_hash },
    :last_name => last_name.map { |o| o.to_hash },
    :street_1 => street_1.map { |o| o.to_hash },
    :street_2 => street_2.map { |o| o.to_hash },
    :city => city.map { |o| o.to_hash },
    :province => province.map { |o| o.to_hash },
    :postal => postal.map { |o| o.to_hash },
    :phone => phone.map { |o| o.to_hash }
  }
end

#to_jsonObject



19688
19689
19690
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19688

def to_json
  JSON.dump(to_hash)
end