Class: CmccHxy::Client
- Inherits:
-
Object
- Object
- CmccHxy::Client
- Defined in:
- lib/cmcc_hxy/client.rb
Instance Method Summary collapse
-
#chk_oauth ⇒ Object
第三方应用获取accessToken后调用CHK_OAUTH接口,获取用户信息 IP:PORT/typtOauth/typt/chk_oauth?data=accesstoken:“sdfsdf”.
- #get_order(user_id) ⇒ Object
- #get_users ⇒ Object
- #host ⇒ Object
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
-
#qry_order(uid) ⇒ Object
第三方应用调用此接口查询业务的开通情况.第三方应用只能查询到有关自己的业务开通情况。 IP:PORT/typtOauth/typt/qry_order?data=“12321”.
Constructor Details
#initialize(token) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/cmcc_hxy/client.rb', line 5 def initialize(token) @token = token end |
Instance Method Details
#chk_oauth ⇒ Object
第三方应用获取accessToken后调用CHK_OAUTH接口,获取用户信息
http://IP:PORT/typtOauth/typt/chk_oauth?data={accesstoken:"sdfsdf"}
请求:
参数名称 Json参数对 类型 是否比需 描述
--------------------------------------------------------------------------------------------
data =>
accesstoken String 是 登录时有开放平台提供
响应:(查询结果json数组)
参数名称 类型 是否必需 描述
--------------------------------------------------------------------------------------------
ID String 是 用户ID
NAME String 是 用户姓名,如果是用户手机号则中间4位由*代替
MOBILE String 是 用户手机号
ROLE String 是 1:学生 2:家长 3:老师 4:管理员
STUNUM String 是 学号
CLASSID String 是 班级ID
GRADEID String 是 年级ID
SCHOOLID String 是 学校ID
COUNTYID String 是 区县ID
CITYID String 是 地市ID
ONLY_ID String 是 对应启迪用户ID
44 45 46 47 48 49 |
# File 'lib/cmcc_hxy/client.rb', line 44 def chk_oauth params = { data: "{accesstoken: #{@token}}" } request("#{self.host}/typtOauth/typt/chk_oauth", {params: params}) end |
#get_order(user_id) ⇒ Object
17 18 19 |
# File 'lib/cmcc_hxy/client.rb', line 17 def get_order(user_id) qry_order(user_id) end |
#get_users ⇒ Object
13 14 15 |
# File 'lib/cmcc_hxy/client.rb', line 13 def get_users chk_oauth end |
#host ⇒ Object
9 10 11 |
# File 'lib/cmcc_hxy/client.rb', line 9 def host @host ||= CmccHxy::Config.hxy_host end |
#qry_order(uid) ⇒ Object
第三方应用调用此接口查询业务的开通情况.第三方应用只能查询到有关自己的业务开通情况。
http://IP:PORT/typtOauth/typt/qry_order?data={accesstoken:"sdfsdf",userid: "12321"}
请求:
参数名称 类型 是否比需 描述
--------------------------------------------------------------------------------------------
accesstoken String 是
userid String 是
响应:
参数名称 类型 是否必需 描述
--------------------------------------------------------------------------------------------
userid String 是
apps =>
appid int 应用ID
appname String 应用名称
applifecycle int 0体验期 1正式期
servicesid String 业务ID
servicename String 业务名称
fee Float 费用
feetype int 0:一次性 1:包月 2:包年
createtime String 订购时间
begintime String 订购时间
endtime String 订购时间
75 76 77 78 79 80 |
# File 'lib/cmcc_hxy/client.rb', line 75 def qry_order(uid) params = { data: "{accesstoken:#{@token}, userid:#{uid}}" } request("#{self.host}/typtOauth/typt/qry_order", {params: params}) end |