Class: TokyoApi::Krautbuster

Inherits:
Base
  • Object
show all
Defined in:
lib/tokyo_api/krautbuster.rb

Instance Method Summary collapse

Methods inherited from Base

#normalized_base_path

Instance Method Details

#base_pathObject



3
4
5
# File 'lib/tokyo_api/krautbuster.rb', line 3

def base_path
  'krautbuster'
end

#full_user(session_id) ⇒ Object



7
8
9
# File 'lib/tokyo_api/krautbuster.rb', line 7

def full_user(session_id)
  client.get_request("#{normalized_base_path}full_user/#{session_id}").body
end

#session_status(session_id) ⇒ Object



11
12
13
# File 'lib/tokyo_api/krautbuster.rb', line 11

def session_status(session_id)
  client.get_request("#{normalized_base_path}session_status/#{session_id}").body
end

#subscription_status(token) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tokyo_api/krautbuster.rb', line 15

def subscription_status(token)
  begin
    client.get_request(subscription_status_path(token)).body
  rescue Vertebrae::ResponseError => e
    # Status 404 is expected in these calls
    if e.status_code == 404
      return nil
    end

    raise
  end
end

#subscription_status_path(token) ⇒ Object



32
33
34
# File 'lib/tokyo_api/krautbuster.rb', line 32

def subscription_status_path(token)
  "/#{normalized_base_path}subscription_status/#{token}"
end

#user_path(session_id, petition_id) ⇒ Object



28
29
30
# File 'lib/tokyo_api/krautbuster.rb', line 28

def user_path(session_id, petition_id)
  "/#{normalized_base_path}user/#{session_id}?petition_id=#{petition_id}"
end