Top Level Namespace

Defined Under Namespace

Modules: Configuration, Gbif Classes: Hash

Constant Summary collapse

NETWORKABLE_EXCEPTIONS =
[Faraday::ClientError,
URI::InvalidURIError,
Encoding::UndefinedConversionError,
ArgumentError,
NoMethodError,
TypeError]

Instance Method Summary collapse

Instance Method Details

#check_data(x, y) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gbifrb/utils.rb', line 19

def check_data(x, y)
  if len2(x) == 1
    testdata = [x]
  else
    testdata = x
  end

  for z in testdata
    if !y.include? z
      raise z + ' is not one of the choices'
    end
  end
end

#len2(x) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/gbifrb/utils.rb', line 33

def len2(x)
  if x.class == String
    return [x].length
  else
    return x.length
  end
end

#make_uaObject



1
2
3
4
5
# File 'lib/gbifrb/utils.rb', line 1

def make_ua
  requa = 'Faraday/v' + Faraday::VERSION
  habua = 'Gbif/v' + Gbif::VERSION
  return requa + ' ' + habua
end

#stop(x) ⇒ Object

Raises:

  • (ArgumentError)


41
42
43
# File 'lib/gbifrb/utils.rb', line 41

def stop(x)
  raise ArgumentError, x
end