class RubyPtvApi::Operation::XLocate::Base

Attributes

result_field_array[R]
search_option_base_array[R]
sort_option_array[R]

Public Instance Methods

additional_fields() click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 40
def additional_fields 
  @result_field_array || []
end
additional_fields=(array) click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 35
def additional_fields=(array)
  check_additional_fields(array)
  @result_field_array = array
end
call(options: nil, sorting: nil, additional_fields: nil) click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 11
def call(options: nil, sorting: nil, additional_fields: nil)
  extra_params(options, sorting, additional_fields)
  response = post(params)
  parse_response(response)
end
extra_params(opts, sort, fields) click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 44
def extra_params(opts, sort, fields)
  self.options = opts if opts
  self.sorting = sort if sort
  self.additional_fields = fields if fields
end
options() click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 22
def options
  @search_option_base_array || []
end
options=(opts) click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 17
def options=(opts)
  raise 'Not implemented'
  @search_option_base_array = opts
end
ptv_path() click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 7
def ptv_path
  'xlocate/rs/XLocate'
end
sorting() click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 31
def sorting
  @sort_option_array || []
end
sorting=(array) click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 26
def sorting=(array)
  raise "Required SortOption Model class" unless array.map{|k| k.is_a?(RubyPtvApi::Model::XLocate::SortOption)}.inject(:&)
  @sort_option_array = array
end

Protected Instance Methods

response_class() click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 52
def response_class
  RubyPtvApi::Model::XLocate::AddressResponse
end

Private Instance Methods

check_additional_fields(values) click to toggle source
# File lib/ruby_ptv_api/operation/x_locate/base.rb, line 58
def check_additional_fields(values)
  values.each do |value|
    unless RubyPtvApi::Constant::RESULT_FIELD.include?(value.to_sym)
      raise WrongParameterFormat.new("Value #{value} is not a additional fields accepted value #{RubyPtvApi::Constant::RESULT_FIELD}")
    end
  end
end