Class: MasspayRubySdk::UserService

Inherits:
Object
  • Object
show all
Defined in:
lib/masspay_ruby_sdk/api/user_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ UserService

Returns a new instance of UserService.



15
16
17
# File 'lib/masspay_ruby_sdk/api/user_service.rb', line 15

def initialize(client)
  @client = client ||= Client.new
end

Instance Method Details

#create_user(body) ⇒ Object

Create a user POST /payout/user

Parameters:

  • body

    The body of the request



22
23
24
25
26
# File 'lib/masspay_ruby_sdk/api/user_service.rb', line 22

def create_user body
  @client.post("payout/user") do |req|
    req.body = body
  end
end

#get_all_users_history(query_params = {}) ⇒ Object

All Users’ Transactions history GET /payout/user/history

Parameters:

  • query_params (defaults to: {})

    The query parameters



64
65
66
67
68
# File 'lib/masspay_ruby_sdk/api/user_service.rb', line 64

def get_all_users_history query_params={}
  @client.get("payout/user/history") do |req|
    req.params = query_params
  end
end

#get_user_by_token(user_token) ⇒ Object

Get user by user token GET /payout/user/user_token



30
31
32
# File 'lib/masspay_ruby_sdk/api/user_service.rb', line 30

def get_user_by_token user_token
  @client.get("payout/user/#{user_token}") 
end

#get_user_history(user_token, query_params = {}) ⇒ Object

Transactions history GET /payout/user/user_token/history

Parameters:

  • query_params (defaults to: {})

    The query parameters



55
56
57
58
59
# File 'lib/masspay_ruby_sdk/api/user_service.rb', line 55

def get_user_history user_token, query_params={}
  @client.get("payout/user/#{user_token}/history") do |req|
    req.params = query_params
  end
end

#update_user(user_token, body) ⇒ Object

Updated user PUT /payout/user/user_token

Parameters:

  • body

    The body of the request



37
38
39
40
41
# File 'lib/masspay_ruby_sdk/api/user_service.rb', line 37

def update_user user_token, body
  @client.put("payout/user/#{user_token}") do |req|
    req.body = body
  end
end

#user_lookup(query_params = {}) ⇒ Object

Lookup an existing user GET /payout/user/lookup

Parameters:

  • query_params (defaults to: {})

    The query parameters



46
47
48
49
50
# File 'lib/masspay_ruby_sdk/api/user_service.rb', line 46

def user_lookup query_params={}
  @client.get("payout/user/lookup") do |req|
    req.params = query_params
  end
end