Class: Emojidex::Service

Inherits:
Collection show all
Defined in:
lib/emojidex/service.rb

Overview

listing and search of emoji from the online service/emojidex.com

Instance Attribute Summary collapse

Attributes inherited from Collection

#categories, #emoji, #raster_source_path, #source_path, #vector_source_path

Attributes included from CollectionCache

#cache_path

Instance Method Summary collapse

Methods inherited from Collection

#add_emoji, #category, #category?, #collect, #each, #find_by_moji, #load_local_collection, #map, #select

Methods included from CollectionAssetInformation

#generate_checksums, #generate_paths, #get_checksums, #get_paths

Methods included from CollectionCache

#cache!, #cache_index, #setup_cache, #write_index

Constructor Details

#initialize(emoji_list = nil, client_opts = {}) ⇒ Service

Returns a new instance of Service.



8
9
10
11
# File 'lib/emojidex/service.rb', line 8

def initialize(emoji_list = nil, client_opts = {})
  super emoji_list
  @client = Emojidex::Client.new client_opts
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



7
8
9
# File 'lib/emojidex/service.rb', line 7

def client
  @client
end

Instance Method Details

#find_by_code(code) ⇒ Object

directly retrieves the emoji with the given code



20
21
22
# File 'lib/emojidex/service.rb', line 20

def find_by_code(code)
  # TODO: perform a query on emojidex API
end

#find_by_code_ja(code) ⇒ Object

emoji on the emojidex service make no language distinctions find_by_code_ja is simply remapped to find_by_code



26
27
28
# File 'lib/emojidex/service.rb', line 26

def find_by_code_ja(code)
  find_by_code(code)
end

#search(criteria = {}) ⇒ Object

sends an API search, adding results with add_emoji returns a collection, and adds results to the @emoji array



15
16
17
# File 'lib/emojidex/service.rb', line 15

def search(criteria = {})
  # TODO: *NOTE try and replicate regex search functionality by passing regex to server
end