Class: Synonymous::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/synonymous/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:) ⇒ Client

Returns a new instance of Client.



11
12
13
# File 'lib/synonymous/client.rb', line 11

def initialize(api_key:)
  @api_key = api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



9
10
11
# File 'lib/synonymous/client.rb', line 9

def api_key
  @api_key
end

Instance Method Details

#get(word) ⇒ Object



15
16
17
# File 'lib/synonymous/client.rb', line 15

def get(word)
  Response.new(word, client.get("#{URI.encode_www_form_component(word).gsub("+", "%20")}?key=#{api_key}"))
end