Class: Wework::Api::Suite

Inherits:
Base
  • Object
show all
Includes:
Methods::Service, Cipher
Defined in:
lib/wework/api/suite.rb

Constant Summary

Constants included from Cipher

Cipher::BLOCK_SIZE, Cipher::CIPHER

Instance Attribute Summary collapse

Attributes inherited from Base

#corp_id, #options, #secret

Instance Method Summary collapse

Methods included from Methods::Service

#authorize_url, #corp_authorize_url, #get_admin_list, #get_auth_info, #get_corp_token, #get_oauth_userinfo, #get_permanent_code, #get_pre_auth_code, #get_session_with_jscode, #get_user_detail, #set_session_info

Methods included from Cipher

#decrypt, #encrypt, #generate_xml, #msg_decrypt, #msg_encrypt, #pack, #signature, #unpack

Methods inherited from Base

#access_token, #get, #post, #post_file, #request, #valid?

Methods included from Methods::Batch

#batch_getresult, #batch_invite, #batch_replaceparty, #batch_replaceuser, #batch_syncuser

Methods included from Methods::Crm

#crm_get_external_contact

Methods included from Methods::Tag

#tag_addtagusers, #tag_create, #tag_delete, #tag_deltagusers, #tag_get, #tag_list, #tag_update

Methods included from Methods::Department

#department_create, #department_delete, #department_list, #department_update

Methods included from Methods::User

#authsucc, #convert_to_openid, #convert_to_userid, #user_batchdelete, #user_create, #user_delete, #user_get, #user_list, #user_simplelist, #user_update

Methods included from Methods::Media

#get_media_url, #media_get, #media_upload

Constructor Details

#initialize(options = {}) ⇒ Suite

Returns a new instance of Suite.



12
13
14
15
16
17
18
# File 'lib/wework/api/suite.rb', line 12

def initialize(options={})
  @suite_id = options.delete(:suite_id)
  @suite_secret = options.delete(:suite_secret)
  @token = @suite_token = options.delete(:suite_token)
  @encoding_aes_key = options.delete(:encoding_aes_key)
  super(options)
end

Instance Attribute Details

#encoding_aes_keyObject (readonly)

Returns the value of attribute encoding_aes_key.



10
11
12
# File 'lib/wework/api/suite.rb', line 10

def encoding_aes_key
  @encoding_aes_key
end

#suite_idObject (readonly)

Returns the value of attribute suite_id.



10
11
12
# File 'lib/wework/api/suite.rb', line 10

def suite_id
  @suite_id
end

#suite_secretObject (readonly)

Returns the value of attribute suite_secret.



10
11
12
# File 'lib/wework/api/suite.rb', line 10

def suite_secret
  @suite_secret
end

#suite_tokenObject (readonly)

Returns the value of attribute suite_token.



10
11
12
# File 'lib/wework/api/suite.rb', line 10

def suite_token
  @suite_token
end

#tokenObject (readonly)

Returns the value of attribute token.



10
11
12
# File 'lib/wework/api/suite.rb', line 10

def token
  @token
end

Instance Method Details

#corp(corp_id, permanent_code) ⇒ Object



28
29
30
# File 'lib/wework/api/suite.rb', line 28

def corp(corp_id, permanent_code)
  Wework::Api::Corp.new(suite: self, corp_id: corp_id, permanent_code: permanent_code)
end

#suite_ticketObject



24
25
26
# File 'lib/wework/api/suite.rb', line 24

def suite_ticket
  Wework.redis.get ticket_key
end

#suite_ticket=(ticket) ⇒ Object



20
21
22
# File 'lib/wework/api/suite.rb', line 20

def suite_ticket= ticket
  Wework.redis.set ticket_key, ticket
end