Class: GovSdkBase

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

Overview

  • Name: GovSDK

    • Description:

    • Author: Pito Salas

    • Copyright: © R. Pito Salas and Associates, Inc.

    • Date: January 2009

    • License: GPL

    This file is part of GovSDK.

    GovSDK is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

    GovSDK is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with GovSDK. If not, see <www.gnu.org/licenses/>.

    require “ruby-debug” Debugger.settings = 1 # list nearby lines on stop Debugger.settings = 1 Debugger.start

Direct Known Subclasses

CongressPerson

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.assume_hash(val) ⇒ Object

Raises:

  • (ArgumentError)


54
55
56
# File 'lib/govsdk_base.rb', line 54

def self.assume_hash val
  raise ArgumentError, "Requires a hash argument. Called from " + caller.shift unless val.kind_of?(Hash)
end

.assume_string(val) ⇒ Object

Raises:

  • (ArgumentError)


62
63
64
# File 'lib/govsdk_base.rb', line 62

def self.assume_string(val)
  raise ArgumentError, "Requires a string argument. Called from " + caller.shift unless val.kind_of?(String)
end

.assume_uses_sunl_apiObject

Raises:

  • (ArgumentError)


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

def self.assume_uses_sunl_api
  raise ArgumentError, "Call requires Sunlight API, so it needs you to set the Sunlight API key" + caller.shift unless GovSdk.sunlight_api.initialized?
end

Instance Method Details

#assume_hash(val) ⇒ Object



58
59
60
# File 'lib/govsdk_base.rb', line 58

def assume_hash val
  self.assume_hash val
end

#assume_nil_or_integer(val) ⇒ Object

Raises:

  • (ArgumentError)


50
51
52
# File 'lib/govsdk_base.rb', line 50

def assume_nil_or_integer val
  raise ArgumentError, "Requires nil or integer argument. Called from " + caller.shift unless  val.nil? || val.kind_of?(Integer)
end

#assume_not_blank(val, message) ⇒ Object

General error checking and reporting methods

Raises:

  • (ArgumentError)


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

def assume_not_blank val, message
  raise ArgumentError, (message + caller.shift) unless val.nil? || val.kind_of?(String)
end

#assume_string(val) ⇒ Object



66
67
68
# File 'lib/govsdk_base.rb', line 66

def assume_string(val)
  self.assume_string val
end

#assume_uses_google_apiObject

Raises:

  • (ArgumentError)


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

def assume_uses_google_api
  raise ArgumentError, "Call requires Google API and Google key" + caller.shift unless GovSdk.google_api.initialized?
end

#assume_uses_sunl_apiObject



46
47
48
# File 'lib/govsdk_base.rb', line 46

def assume_uses_sunl_api
  self.assume_uses_sunl_api
end