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.



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

def initialize(api_key:)
  @api_key = api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



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

def api_key
  @api_key
end

Instance Method Details

#get(word) ⇒ Object



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

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