Class: Cloudability::Organizations

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/cloudability/organizations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Organizations

Returns a new instance of Organizations.

Raises:

  • (ArgumentError)


9
10
11
12
13
# File 'lib/cloudability/organizations.rb', line 9

def initialize(options={})
  raise ArgumentError, "You must provide an auth token" if options[:auth_token].nil?

  @auth_token = options[:auth_token]
end

Instance Attribute Details

#auth_tokenObject

Returns the value of attribute auth_token.



7
8
9
# File 'lib/cloudability/organizations.rb', line 7

def auth_token
  @auth_token
end

Instance Method Details

#invitationsObject



20
21
22
23
# File 'lib/cloudability/organizations.rb', line 20

def invitations
  response = get_url("/organizations/invitations?auth_token=#{@auth_token}")
  convert_to_mashes(response)
end

#invite_user(args) ⇒ Object

Invite a user to your organization

Parameters:

  • args (Hash)

    to pass to HTTParty @option [String] email (required) @option [String] name @option [String] role_id

Raises:

  • (ArgumentError)


36
37
38
39
40
41
# File 'lib/cloudability/organizations.rb', line 36

def invite_user(args)
  raise ArgumentError, "You must provide an email" if args[:email].nil?

  response = post_url("/organizations/invitations?auth_token=#{@auth_token}", args)
  Hashie::Mash.new(response)
end

#my_organizationObject



15
16
17
18
# File 'lib/cloudability/organizations.rb', line 15

def my_organization
  response = get_url("/organizations?auth_token=#{@auth_token}")
  Hashie::Mash.new(response)
end

#rolesObject



25
26
27
28
# File 'lib/cloudability/organizations.rb', line 25

def roles
  response = get_url("/organizations/roles?auth_token=#{@auth_token}")
  convert_to_mashes(response)
end