Module: RBSLURL

Defined in:
lib/rbslurl.rb

Class Method Summary collapse

Class Method Details

.generate_slurl(region, coordinates, params = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rbslurl.rb', line 6

def RBSLURL.generate_slurl(region, coordinates, params = nil)
  #validates if arguments are valid, return nil if they are not
  if region == nil || region == "" || coordinates == nil
    return nil
  end 

  if coordinates.class == String

    coordinates_local = Array.new
    #parsing string coordinates. the following formats can be received
    # - <xxxxx,xxxxx,xxxxx>
    # - xxxxx,xxxxx,xxxxx
    # - <xxxxx,xxxx>
    # - xxxxx,xxxxx
    coordinates_local = parse_coordinates(coordinates)

    return self.build_slurl(region, coordinates_local, params)

  elsif coordinates.class == Array
    return self.build_slurl(region, coordinates, params)
  end

end