Class: Mashery::Member

Inherits:
ApiObjectBase show all
Defined in:
lib/mashery/member.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiObjectBase

delete, fetch, #initialize, method

Constructor Details

This class inherits a constructor from Mashery::ApiObjectBase

Instance Attribute Details

#address1Object

Returns the value of attribute address1.



4
5
6
# File 'lib/mashery/member.rb', line 4

def address1
  @address1
end

#address2Object

Returns the value of attribute address2.



4
5
6
# File 'lib/mashery/member.rb', line 4

def address2
  @address2
end

#area_statusObject

Returns the value of attribute area_status.



4
5
6
# File 'lib/mashery/member.rb', line 4

def area_status
  @area_status
end

#blogObject

Returns the value of attribute blog.



4
5
6
# File 'lib/mashery/member.rb', line 4

def blog
  @blog
end

#companyObject

Returns the value of attribute company.



4
5
6
# File 'lib/mashery/member.rb', line 4

def company
  @company
end

#country_codeObject

Returns the value of attribute country_code.



4
5
6
# File 'lib/mashery/member.rb', line 4

def country_code
  @country_code
end

#createdObject (readonly)

Returns the value of attribute created.



3
4
5
# File 'lib/mashery/member.rb', line 3

def created
  @created
end

#display_nameObject

Returns the value of attribute display_name.



4
5
6
# File 'lib/mashery/member.rb', line 4

def display_name
  @display_name
end

#emailObject

Returns the value of attribute email.



4
5
6
# File 'lib/mashery/member.rb', line 4

def email
  @email
end

#external_idObject

Returns the value of attribute external_id.



4
5
6
# File 'lib/mashery/member.rb', line 4

def external_id
  @external_id
end

#first_nameObject

Returns the value of attribute first_name.



4
5
6
# File 'lib/mashery/member.rb', line 4

def first_name
  @first_name
end

#imObject

Returns the value of attribute im.



4
5
6
# File 'lib/mashery/member.rb', line 4

def im
  @im
end

#imsvcObject

Returns the value of attribute imsvc.



4
5
6
# File 'lib/mashery/member.rb', line 4

def imsvc
  @imsvc
end

#last_nameObject

Returns the value of attribute last_name.



4
5
6
# File 'lib/mashery/member.rb', line 4

def last_name
  @last_name
end

#localityObject

Returns the value of attribute locality.



4
5
6
# File 'lib/mashery/member.rb', line 4

def locality
  @locality
end

#passwd_newObject

Returns the value of attribute passwd_new.



4
5
6
# File 'lib/mashery/member.rb', line 4

def passwd_new
  @passwd_new
end

#phoneObject

Returns the value of attribute phone.



4
5
6
# File 'lib/mashery/member.rb', line 4

def phone
  @phone
end

#postal_codeObject

Returns the value of attribute postal_code.



4
5
6
# File 'lib/mashery/member.rb', line 4

def postal_code
  @postal_code
end

#regionObject

Returns the value of attribute region.



4
5
6
# File 'lib/mashery/member.rb', line 4

def region
  @region
end

#registration_ipaddrObject

Returns the value of attribute registration_ipaddr.



4
5
6
# File 'lib/mashery/member.rb', line 4

def registration_ipaddr
  @registration_ipaddr
end

#updatedObject (readonly)

Returns the value of attribute updated.



3
4
5
# File 'lib/mashery/member.rb', line 3

def updated
  @updated
end

#uriObject

Returns the value of attribute uri.



4
5
6
# File 'lib/mashery/member.rb', line 4

def uri
  @uri
end

#usernameObject

Returns the value of attribute username.



4
5
6
# File 'lib/mashery/member.rb', line 4

def username
  @username
end

Class Method Details

.create(username, display_name, email, fields = {}) ⇒ Object



8
9
10
11
12
# File 'lib/mashery/member.rb', line 8

def self.create(username, display_name, email, fields = {})
  fields ||= {}
  our_fields = fields.merge('username' => username, 'display_name' => display_name, 'email' => email)
  super(our_fields)
end

Instance Method Details

#add_role(role_or_id) ⇒ Object



14
15
16
17
# File 'lib/mashery/member.rb', line 14

def add_role(role_or_id)
  role_id = role_or_id.is_a?(Role) ? role_or_id.id : role_or_id
  Mashery.client.call_remote('member.addRole', {'username' => username}, {'id' => role_id})
end

#remove_role(role_or_id) ⇒ Object



19
20
21
22
# File 'lib/mashery/member.rb', line 19

def remove_role(role_or_id)
  role_id = role_or_id.is_a?(Role) ? role_or_id.id : role_or_id
  Mashery.client.call_remote('member.removeRole', {'username' => username}, {'id' => role_id})
end