Module: Moneta::Api::DataMapper

Included in:
Requests::ApprovePhoneApplyCodeRequest, Requests::ApprovePhoneSendConfirmationRequest, Requests::CreateAccountRequest, Requests::CreateBankAccountRequest, Requests::CreateProfileRequest, Requests::EditBankAccountRequest, Requests::EditProfileRequest, Requests::FindAccountsListRequest, Requests::FindBankAccountsRequest, Requests::FindLastOperationsListRequest, Requests::FindOperationsListRequest, Requests::GetAccountPaymentPasswordChallengeRequest, Requests::GetProfileInfoRequest, Requests::RefundRequest, Responses::ApprovePhoneApplyCodeResponse, Responses::ApprovePhoneSendConfirmationResponse, Responses::AuthoriseTransactionBatchResponse, Responses::CancelTransactionBatchResponse, Responses::ConfirmTransactionBatchResponse, Responses::CreateAccountResponse, Responses::CreateBankAccountResponse, Responses::CreateProfileResponse, Responses::EditBankAccountResponse, Responses::EditProfileResponse, Responses::FindAccountByAliasResponse, Responses::FindAccountByIdResponse, Responses::FindAccountsListResponse, Responses::FindBankAccountsResponse, Responses::GetAccountPaymentPasswordChallengeResponse, Responses::GetOperationDetailsByIdResponse, Responses::InvoiceBatchResponse, Responses::KeyValueResponse, Responses::TransferBatchResponse, Responses::VerifyPaymentBatchResponse, Types::AccountAccessInfo, Types::AccountInfo, Types::CancelTransactionBatchResponseType, Types::CancelTransactionRequestType, Types::CancelTransactionResponseType, Types::ConfirmTransactionRequestType, Types::Entity, Types::FindOperationsListRequestFilter, Types::ForecastTransactionResponseType, Types::HashEntity, Types::InvoiceRequestType, Types::KeyValueAttribute, Types::KeyValueEntity, Types::OperationInfo, Types::OperationInfoBatchResponseType, Types::OperationInfoList, Types::Pager, Types::TransactionBatchResponseType, Types::TransactionResponseType, Types::VerifyTransferResponseType
Defined in:
lib/moneta/api/data_mapper.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#fill(data) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/moneta/api/data_mapper.rb', line 43

def fill(data)
  properties.each do |property, type|
    if data.has_key?(property)
      value = data[property]
      property_value = type.nil? ? value : build_complex_value(type, value)
      instance_variable_set("@#{ property }", property_value)
    end
  end

  self
end

#to_hashObject



55
56
57
58
59
60
61
62
# File 'lib/moneta/api/data_mapper.rb', line 55

def to_hash
  properties.each_with_object({}) do |(property, _), hash|
    value = send(property)
    unless value.nil?
      hash[ property.to_s.camelize(:lower) ] = to_hash_complex_value(value)
    end
  end
end