Class: Io::Flow::V0::Models::MerchantOfRecordEntity

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

Overview

The merchant of record entity provides the legal name and address of the specific Flow entity serving as merchant of record.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ MerchantOfRecordEntity

Returns a new instance of MerchantOfRecordEntity.



36492
36493
36494
36495
36496
36497
36498
36499
36500
36501
36502
36503
36504
36505
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36492

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:organization, :name, :vat, :streets, :city, :country], 'MerchantOfRecordEntity')
  @organization = (x = opts.delete(:organization); x.is_a?(::Io::Flow::V0::Models::OrganizationReference) ? x : ::Io::Flow::V0::Models::OrganizationReference.new(x))
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @vat = (x = opts.delete(:vat); x.is_a?(::Io::Flow::V0::Models::MerchantOfRecordEntityRegistration) ? x : ::Io::Flow::V0::Models::MerchantOfRecordEntityRegistration.new(x))
  @streets = HttpClient::Preconditions.assert_class('streets', opts.delete(:streets), Array).map { |v| HttpClient::Preconditions.assert_class('streets', v, String) }
  @city = HttpClient::Preconditions.assert_class('city', opts.delete(:city), String)
  @province = (x = opts.delete(:province); x.nil? ? nil : HttpClient::Preconditions.assert_class('province', x, String))
  @postal = (x = opts.delete(:postal); x.nil? ? nil : HttpClient::Preconditions.assert_class('postal', x, String))
  @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
  @phone = (x = opts.delete(:phone); x.nil? ? nil : HttpClient::Preconditions.assert_class('phone', x, String))
  @email = (x = opts.delete(:email); x.nil? ? nil : HttpClient::Preconditions.assert_class('email', x, String))
end

Instance Attribute Details

#cityObject (readonly)

Returns the value of attribute city.



36490
36491
36492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36490

def city
  @city
end

#countryObject (readonly)

Returns the value of attribute country.



36490
36491
36492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36490

def country
  @country
end

#emailObject (readonly)

Returns the value of attribute email.



36490
36491
36492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36490

def email
  @email
end

#nameObject (readonly)

Returns the value of attribute name.



36490
36491
36492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36490

def name
  @name
end

#organizationObject (readonly)

Returns the value of attribute organization.



36490
36491
36492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36490

def organization
  @organization
end

#phoneObject (readonly)

Returns the value of attribute phone.



36490
36491
36492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36490

def phone
  @phone
end

#postalObject (readonly)

Returns the value of attribute postal.



36490
36491
36492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36490

def postal
  @postal
end

#provinceObject (readonly)

Returns the value of attribute province.



36490
36491
36492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36490

def province
  @province
end

#streetsObject (readonly)

Returns the value of attribute streets.



36490
36491
36492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36490

def streets
  @streets
end

#vatObject (readonly)

Returns the value of attribute vat.



36490
36491
36492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36490

def vat
  @vat
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



36511
36512
36513
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36511

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

#to_hashObject



36515
36516
36517
36518
36519
36520
36521
36522
36523
36524
36525
36526
36527
36528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36515

def to_hash
  {
    :organization => organization.to_hash,
    :name => name,
    :vat => vat.to_hash,
    :streets => streets,
    :city => city,
    :province => province,
    :postal => postal,
    :country => country,
    :phone => phone,
    :email => email
  }
end

#to_jsonObject



36507
36508
36509
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36507

def to_json
  JSON.dump(to_hash)
end