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.



44583
44584
44585
44586
44587
44588
44589
44590
44591
44592
44593
44594
44595
44596
44597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44583

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:organization, :name, :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.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::MerchantOfRecordEntityRegistration) ? x : ::Io::Flow::V0::Models::MerchantOfRecordEntityRegistration.new(x)))
  @identifiers = (x = opts.delete(:identifiers); x.nil? ? nil : HttpClient::Preconditions.assert_class('identifiers', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::EntityIdentifier) ? x : ::Io::Flow::V0::Models::EntityIdentifier.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.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def city
  @city
end

#countryObject (readonly)

Returns the value of attribute country.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def country
  @country
end

#emailObject (readonly)

Returns the value of attribute email.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def email
  @email
end

#identifiersObject (readonly)

Returns the value of attribute identifiers.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def identifiers
  @identifiers
end

#nameObject (readonly)

Returns the value of attribute name.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def name
  @name
end

#organizationObject (readonly)

Returns the value of attribute organization.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def organization
  @organization
end

#phoneObject (readonly)

Returns the value of attribute phone.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def phone
  @phone
end

#postalObject (readonly)

Returns the value of attribute postal.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def postal
  @postal
end

#provinceObject (readonly)

Returns the value of attribute province.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def province
  @province
end

#streetsObject (readonly)

Returns the value of attribute streets.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def streets
  @streets
end

#vatObject (readonly)

Returns the value of attribute vat.



44581
44582
44583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44581

def vat
  @vat
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44603
44604
44605
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44603

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

#to_hashObject



44607
44608
44609
44610
44611
44612
44613
44614
44615
44616
44617
44618
44619
44620
44621
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44607

def to_hash
  {
    :organization => organization.to_hash,
    :name => name,
    :vat => vat.nil? ? nil : vat.to_hash,
    :identifiers => identifiers.nil? ? nil : identifiers.map { |o| o.to_hash },
    :streets => streets,
    :city => city,
    :province => province,
    :postal => postal,
    :country => country,
    :phone => phone,
    :email => email
  }
end

#to_jsonObject



44599
44600
44601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44599

def to_json
  JSON.dump(to_hash)
end