Class: NdsApi::Method

Inherits:
Object
  • Object
show all
Defined in:
lib/nds_api/method.rb

Instance Method Summary collapse

Constructor Details

#initialize(method = '') ⇒ Method



8
9
10
# File 'lib/nds_api/method.rb', line 8

def initialize(method = '')
  @method = method.to_s
end

Instance Method Details

#actionObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/nds_api/method.rb', line 28

def action
  action = method_split[0]
  object_type =
    case method_split[1]
    when 'child'
      'children'
    when 'client'
      'clients'
    when 'referral'
      'referrals'
    when 'person'
      'persons'
    when 'provider'
      'providers'
    when 'providers'
      'providers'
    end
  "#{action}_#{object_type}#{method_split[2] ? "_#{method_split[2]}" : ''}"
end

#is_create?Boolean



12
13
14
# File 'lib/nds_api/method.rb', line 12

def is_create?
  @method.include? 'create'
end

#is_search?Boolean



20
21
22
# File 'lib/nds_api/method.rb', line 20

def is_search?
  @method.include? 'search'
end

#is_search_providers?Boolean



24
25
26
# File 'lib/nds_api/method.rb', line 24

def is_search_providers?
  @method.include? 'search_providers'
end

#is_update?Boolean



16
17
18
# File 'lib/nds_api/method.rb', line 16

def is_update?
  @method.include? 'update'
end