Class: Worldline::Acquiring::SDK::V1::Domain::ByMerchantRootIds

Inherits:
MerchantScope show all
Defined in:
lib/worldline/acquiring/sdk/v1/domain/by_merchant_root_ids.rb

Constant Summary collapse

MERCHANT_SCOPE_TYPE =
'BY_MERCHANT_ROOT_IDS'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Domain::DataObject

new_from_hash

Constructor Details

#initialize ⇒ ByMerchantRootIds

Returns a new instance of ByMerchantRootIds.



21
22
23
24
# File 'lib/worldline/acquiring/sdk/v1/domain/by_merchant_root_ids.rb', line 21

def initialize
  super
  @merchant_scope_type = MERCHANT_SCOPE_TYPE
end

Instance Attribute Details

#merchant_root_ids ⇒ Array<Worldline::Acquiring::SDK::V1::Domain::MerchantRootIdItem>

Returns the current value of merchant_root_ids.

Returns:



13
14
15
# File 'lib/worldline/acquiring/sdk/v1/domain/by_merchant_root_ids.rb', line 13

def merchant_root_ids
  @merchant_root_ids
end

Instance Method Details

#from_hash(hash) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/worldline/acquiring/sdk/v1/domain/by_merchant_root_ids.rb', line 39

def from_hash(hash)
  super
  @merchant_scope_type = MERCHANT_SCOPE_TYPE
  if hash.has_key? 'merchantRootIds'
    raise TypeError, "value '%s' is not an Array" % [hash['merchantRootIds']] unless hash['merchantRootIds'].is_a? Array
    @merchant_root_ids = []
    hash['merchantRootIds'].each do |e|
      @merchant_root_ids << Worldline::Acquiring::SDK::V1::Domain::MerchantRootIdItem.new_from_hash(e)
    end
  end
end

#merchant_scope_type ⇒ String

Returns:

  • (String)


27
28
29
# File 'lib/worldline/acquiring/sdk/v1/domain/by_merchant_root_ids.rb', line 27

def merchant_scope_type
  MERCHANT_SCOPE_TYPE
end

#to_h ⇒ Hash

Returns:

  • (Hash)


32
33
34
35
36
37
# File 'lib/worldline/acquiring/sdk/v1/domain/by_merchant_root_ids.rb', line 32

def to_h
  hash = super
  hash['merchantRootIds'] = @merchant_root_ids.collect{|val| val.to_h} unless @merchant_root_ids.nil?
  hash['merchantScopeType'] = MERCHANT_SCOPE_TYPE
  hash
end