Skip to content

Commit

Permalink
Revert "updating this so it works with multi field infos"
Browse files Browse the repository at this point in the history
This reverts commit e7c4512.
  • Loading branch information
pzhang committed Mar 11, 2012
1 parent e4eac66 commit 2c73e95
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 122 deletions.
77 changes: 12 additions & 65 deletions lib/halberd.rb
@@ -1,11 +1,10 @@
require 'savon_model'
require 'orderedhash'
require './lib/utils'

Savon.configure do |config|
config.soap_version = 2
config.log_level = :info
config.log = true
config.log = false
end

module Halberd
Expand Down Expand Up @@ -461,33 +460,19 @@ class Items

CREDENTIAL_CONVERT = {:is_optional_mfa => "isOptionalMFA",
:is_mfa => "isMFA"}

CREDENTIAL_ORDER = [:name,
:display_name,
:is_editable,
:is_optional,
:is_escaped,
:is_optional_mfa,
:is_mfa,
:default_values,
:value,
:values,
:valid_values,
:display_valid_values,
:value_identifier,
:value_identifiers,
:value_identifier,
:value_mask,
:value_masks,
:field_type,
:field_types,
:validation_rules,
:size,
:sizes,
:maxlength,
:maxlengths,
:user_profile_mapping_expressions,
:"@xsi:type"]

:maxlength]

def initialize(us, you, opts = {})
@us = us
Expand Down Expand Up @@ -1080,53 +1065,17 @@ def register!(content_service_id, opts = {})

user_credentials && user_credentials.map! do |credential|
CREDENTIAL_ORDER.inject({}) do |hsh, key|
hsh[CREDENTIAL_CONVERT[key] || key] = credential[key] unless credential[key].nil?
hsh[CREDENTIAL_CONVERT[key] || key] = credential[key]
hsh
end
end

@register_response = item_client.request :sl, :add_item_for_content_service1 do
soap.element_form_default = :unqualified
soap.namespaces['xmlns:tns1'] = "http://collections.soap.yodlee.com"
soap.namespaces['xmlns:login'] = 'http://login.ext.soap.yodlee.com'
soap.namespaces['xmlns:common'] = 'http://common.soap.yodlee.com'

soap.body do |xml|
xml.userContext("xsi:type" => "common:UserContext") do
xml.cobrandId(credentials.cobrand_id)
xml.channelId(us.channel_id)
xml.locale("xsi:type" => "collections:Locale") do
credentials.locale.each_pair do |k,v|
xml.tag!(k,v)
end
end
xml.tncVersion(credentials.tnc_version)
xml.applicationId(credentials.application_id)
xml.cobrandConversationCredentials("xsi:type" => "login:SessionCredentials") do
xml.sessionToken(us.session_token)
end
xml.preferenceInfo do
prefs.each_pair do |k,v|
xml.tag!(k, v)
end
end
xml.conversationCredentials("xsi:type" => "login:SessionCredentials") do
xml.sessionToken(you.session_token)
end
xml.valid(true)
xml.isPasswordExpired(false)
end

xml.contentServiceId(content_service_id)
xml.credentialFields do
Halberd::Utils.new.tag_xml(xml, 'elements', user_credentials)
end

xml.shareCredentialsWithinSite(true)
xml.startRefreshItemOnAddition(refresh)
end
=begin
= {
soap.body = {
:user_context => {
:cobrand_id => credentials.cobrand_id,
:channel_id => us.channel_id,
Expand All @@ -1152,21 +1101,19 @@ def register!(content_service_id, opts = {})
}
},
:content_service_id => content_service_id,
:credential_fields => credential_fields,
#{
# :elements => user_credentials,
# :attributes! => {
# :elements => { "xsi:type" => "common:FieldInfoSingle" },
#}
#},
:credential_fields => {
:elements => user_credentials,
:attributes! => {
:elements => { "xsi:type" => "common:FieldInfoSingle" },
}
},
:share_credentials_within_site => true,
:start_refresh_item_on_addition => refresh,
:order! => [:user_context, :content_service_id, :credential_fields, :share_credentials_within_site, :start_refresh_item_on_addition],
:attributes! => {
:user_context => { "xsi:type" => "common:UserContext" },
}
}
=end
end

item_registered!
Expand Down
57 changes: 0 additions & 57 deletions lib/utils.rb

This file was deleted.

0 comments on commit 2c73e95

Please sign in to comment.