Class: Mb::Credentials

Inherits:
Options show all
Defined in:
lib/mindbody/credentials.rb

Direct Known Subclasses

SourceCredentials

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Options

#arrayify, public_var_names

Constructor Details

#initialize(name = nil, password = nil, ids = []) ⇒ Credentials

Allow for Credentials.new to be used… and set at later



6
7
8
9
10
# File 'lib/mindbody/credentials.rb', line 6

def initialize(name = nil, password = nil, ids = [])
	@name = name
	@password = password
	arrayify ids, :ids	
end

Instance Attribute Details

#idsObject

Returns the value of attribute ids.



3
4
5
# File 'lib/mindbody/credentials.rb', line 3

def ids
  @ids
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/mindbody/credentials.rb', line 3

def name
  @name
end

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'lib/mindbody/credentials.rb', line 3

def password
  @password
end

Instance Method Details

#to_hashObject

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



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mindbody/credentials.rb', line 14

def to_hash

	mapper = self.class.map || {}

	{ 
		mapper[:name] || "Name"  => @name,
		 
		mapper[:password]  || "Password" => @password,
	
		mapper[:ids] || "Ids" => { "int" =>  @ids}
	}

end