Module: ThreeTapsAPI

Defined in:
lib/three_taps_api/base.rb,
lib/three_taps_api/search.rb,
lib/three_taps_api/location.rb,
lib/three_taps_api/reference.rb,
lib/three_taps_api/valid_parameters.rb

Defined Under Namespace

Classes: Base, Location, Reference, Search

Constant Summary collapse

@@valid_parameters =
%w(category_group category_groups
category categories radius 
lat long source sources external_id 
heading body text timestamp id 
price currency annotations status 
state has_image has_price include_deleted 
only_deleted location locations)

Class Method Summary collapse

Class Method Details

.invalid_parameter?(str) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/three_taps_api/valid_parameters.rb', line 17

def self.invalid_parameter?(str)
  !self.valid_parameter? str
end

.rec_hash_to_openstruct(hash) ⇒ Object

Raises:

  • (TypeError)


4
5
6
7
8
# File 'lib/three_taps_api/base.rb', line 4

def self.rec_hash_to_openstruct(hash)
  raise TypeError  if not hash.is_a? Hash
  hash = hash.map { |k, v| [k, v.is_a?(Hash) ? rec_hash_to_openstruct(v) : v] }
  OpenStruct.new Hash[hash]
end

.valid_parameter?(str) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/three_taps_api/valid_parameters.rb', line 13

def self.valid_parameter?(str)
  @@valid_parameters.include? str
end

.valid_parametersObject



9
10
11
# File 'lib/three_taps_api/valid_parameters.rb', line 9

def self.valid_parameters 
  @@valid_parameters
end