Class: Bootpay::Commerce::UserModule

Inherits:
Object
  • Object
show all
Defined in:
lib/bootpay/commerce/user.rb

Instance Method Summary collapse

Constructor Details

#initialize(bootpay) ⇒ UserModule

Returns a new instance of UserModule.



8
9
10
# File 'lib/bootpay/commerce/user.rb', line 8

def initialize(bootpay)
  @bootpay = bootpay
end

Instance Method Details

#authentication_data(stand_id) ⇒ Object

본인인증 데이터 조회



29
30
31
# File 'lib/bootpay/commerce/user.rb', line 29

def authentication_data(stand_id)
  @bootpay.get("users/authenticate/#{stand_id}")
end

#check_exist(key, value) ⇒ Object

중복 체크



23
24
25
26
# File 'lib/bootpay/commerce/user.rb', line 23

def check_exist(key, value)
  encoded_value = URI.encode_www_form_component(value)
  @bootpay.get("users/join/#{key}?pk=#{encoded_value}")
end

#delete(user_id) ⇒ Object

사용자 삭제



63
64
65
# File 'lib/bootpay/commerce/user.rb', line 63

def delete(user_id)
  @bootpay.delete("users/#{user_id}")
end

#detail(user_id) ⇒ Object

사용자 상세 조회



52
53
54
# File 'lib/bootpay/commerce/user.rb', line 52

def detail(user_id)
  @bootpay.get("users/#{user_id}")
end

#join(user) ⇒ Object

회원가입



18
19
20
# File 'lib/bootpay/commerce/user.rb', line 18

def join(user)
  @bootpay.post('users/join', user)
end

#list(params = {}) ⇒ Object

사용자 목록 조회



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/bootpay/commerce/user.rb', line 39

def list(params = {})
  query_params = {}
  query_params[:page]        = params[:page]        unless params[:page].nil?
  query_params[:limit]       = params[:limit]       unless params[:limit].nil?
  query_params[:keyword]     = params[:keyword]     if params[:keyword]
  query_params[:member_type] = params[:member_type] unless params[:member_type].nil?
  query_params[:type]        = params[:type]        if params[:type]

  query = build_query(query_params)
  @bootpay.get("users#{query}")
end

#login(login_id, login_pw) ⇒ Object

로그인



34
35
36
# File 'lib/bootpay/commerce/user.rb', line 34

def (, )
  @bootpay.post('users/login', { login_id: , login_pw:  })
end

#token(user_id) ⇒ Object

사용자 토큰 발급



13
14
15
# File 'lib/bootpay/commerce/user.rb', line 13

def token(user_id)
  @bootpay.post('users/login/token', { user_id: user_id })
end

#update(user) ⇒ Object

사용자 정보 수정

Raises:

  • (ArgumentError)


57
58
59
60
# File 'lib/bootpay/commerce/user.rb', line 57

def update(user)
  raise ArgumentError, 'user_id is required' unless user[:user_id]
  @bootpay.put("users/#{user[:user_id]}", user)
end