Sha256: 0ccb387e379aeae9383c70d2e0558bc8aa12b795e64329bffb281ec3df7d68e9

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 Bytes

Contents

class Credentials
	attr_accessor :name, :password, :ids

	#A map describing how the local private instance variables should show for public services
	def self.public_var_names (soap_names_map)
		@@map =  soap_names_map
	end
	  
	def initialize(name, password, ids)
		 @name = name
		 @password = password

		begin
			ids.count #Is this an array?
		rescue
			ids = [ids]
		end		
				
		@ids = ids
	end

	#Return a hash ready for inclusion in a savon SOAP request, 
	#allow instance variables to renamed dependent on a map set up in the class
	def to_hash
		mapper = @@map || {}
		 
		{ 
			mapper[:name] || "Name"  => @name,
			 
			mapper[:password]  || "Password" => @password,
			
			mapper[:ids] || "Ids" => { "int" =>  @ids}
		}

	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mindbody-0.0.1 lib/mindbody/credentials.rb