Module: Tinypass::Gateway

Extended by:
Gateway
Included in:
Tinypass, Gateway
Defined in:
lib/tinypass/gateway.rb

Defined Under Namespace

Classes: AccessDetails, PagedList

Instance Method Summary collapse

Instance Method Details

#cancel_subscription(params) ⇒ Object



34
35
36
# File 'lib/tinypass/gateway.rb', line 34

def cancel_subscription(params)
  post('subscription/cancel', params)
end

#fetch_access_detail(rid, user_ref) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/tinypass/gateway.rb', line 9

def fetch_access_detail(rid, user_ref)
  params = { rid: rid, user_ref: user_ref }
  response = get('access', params)

  return unless response

  AccessDetails.new(MultiJson.load(response))
end

#fetch_access_details(params) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/tinypass/gateway.rb', line 18

def fetch_access_details(params)
  pagesize = params.delete(:pagesize) || params.delete("pagesize") || 500
  params[:pagesize] = pagesize
  response = get('access/search', params)

  return [] unless response

  PagedList.new(MultiJson.load(response))
end

#fetch_subscription_details(params) ⇒ Object



28
29
30
31
32
# File 'lib/tinypass/gateway.rb', line 28

def fetch_subscription_details(params)
  response = get('subscription/search', params)

  MultiJson.load(response)
end

#grant_access(params) ⇒ Object



38
39
40
# File 'lib/tinypass/gateway.rb', line 38

def grant_access(params)
  post('access/grant', params)
end

#revoke_access(params) ⇒ Object



42
43
44
# File 'lib/tinypass/gateway.rb', line 42

def revoke_access(params)
  post('access/revoke', params)
end