class NdsApi::Method

Public Class Methods

new(method = '') click to toggle source
# File lib/nds_api/method.rb, line 8
def initialize(method = '')
  @method = method.to_s
end

Public Instance Methods

action() click to toggle source
# 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?() click to toggle source
# File lib/nds_api/method.rb, line 12
def is_create?
  @method.include? 'create'
end
is_search?() click to toggle source
# File lib/nds_api/method.rb, line 20
def is_search?
  @method.include? 'search'
end
is_search_providers?() click to toggle source
# File lib/nds_api/method.rb, line 24
def is_search_providers?
  @method.include? 'search_providers'
end
is_update?() click to toggle source
# File lib/nds_api/method.rb, line 16
def is_update?
  @method.include? 'update'
end

Private Instance Methods

method_split() click to toggle source
# File lib/nds_api/method.rb, line 50
def method_split
  @method_split ||= @method.split('_')
end