Class: RouteNGNClient::Code

Inherits:
RemoteModel show all
Defined in:
lib/routengn_client/models/code.rb

Constant Summary

Constants inherited from RemoteModel

RemoteModel::DEFAULT_RESOURCE_ATTRIBUTES

Instance Attribute Summary

Attributes included from RemoteModel::ClassMethods

#resource_attributes

Attributes inherited from Model

#attributes, #request_account_id

Attributes included from Model::ClassMethods

#children, #only_children, #parents

Class Method Summary collapse

Methods included from RemoteModel::ClassMethods

#all, #collection_name, #create!, #find, #index_method, #path_base, #path_ext, #set_resource_attributes, #where

Methods inherited from Model

#initialize, #to_hash, #to_json, #to_log

Methods included from Model::ClassMethods

#belongs_to, #from_hash, #from_json, #has_many, #has_one

Methods included from Logging

#init_logger, #logger

Constructor Details

This class inherits a constructor from RouteNGNClient::Model

Class Method Details

.find_by_dialcodes(dialcodes, options = {}, &callback) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/routengn_client/models/code.rb', line 19

def find_by_dialcodes(dialcodes, options = {}, &callback)
  options = {:page => 1, :per_page => (dialcodes.length + 1)}.merge(self.resource_attributes[:request_options]).merge(options)

  models = all({:code => {:dialcode => {'$in' => dialcodes}}}, options)

  callback.call(models) if callback

  models
end

.find_by_exploded_dialcode(dialcode, options = {}, &callback) ⇒ Object



14
15
16
17
# File 'lib/routengn_client/models/code.rb', line 14

def find_by_exploded_dialcode(dialcode, options = {}, &callback)
  subsets = Utils.string_subsets dialcode
  find_by_dialcodes subsets, options, &callback
end