Class: Emojidex::Client
- Inherits:
-
Object
- Object
- Emojidex::Client
- Includes:
- API::Categories, API::Emoji, API::Search::Emoji
- Defined in:
- lib/emojidex/client.rb
Overview
get the data from emojidex.com
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_username ⇒ Object
Returns the value of attribute api_username.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
Instance Method Summary collapse
- #connection_options ⇒ Object
- #get(path, params = {}) ⇒ Object
-
#initialize(opts = {}) ⇒ Client
constructor
A new instance of Client.
- #user_agent ⇒ Object
Methods included from API::Search::Emoji
Methods included from API::Emoji
#emoji, #emoji_detailed, #single_emoji, #single_emoji_detailed
Methods included from API::Categories
Constructor Details
#initialize(opts = {}) ⇒ Client
Returns a new instance of Client.
18 19 20 21 22 |
# File 'lib/emojidex/client.rb', line 18 def initialize(opts = {}) @api_key = opts[:api_key] @api_username = opts[:api_username] @host = opts[:host] || 'https://www.emojidex.com/' end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/emojidex/client.rb', line 11 def api_key @api_key end |
#api_username ⇒ Object
Returns the value of attribute api_username.
11 12 13 |
# File 'lib/emojidex/client.rb', line 11 def api_username @api_username end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
12 13 14 |
# File 'lib/emojidex/client.rb', line 12 def host @host end |
Instance Method Details
#connection_options ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/emojidex/client.rb', line 24 def @connection_options ||= { url: @host, headers: { accept: 'application/json', user_agent: user_agent } } end |
#get(path, params = {}) ⇒ Object
38 39 40 |
# File 'lib/emojidex/client.rb', line 38 def get(path, params = {}) request(:get, path, params) end |
#user_agent ⇒ Object
34 35 36 |
# File 'lib/emojidex/client.rb', line 34 def user_agent @user_agent ||= 'Emojidex Toolkit Client' end |