Class: Wego::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(end_point, attributes = {}) ⇒ Client

Returns a new instance of Client.



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

def initialize(end_point, attributes = {})
  @end_point = end_point
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



7
8
9
# File 'lib/wego/client.rb', line 7

def attributes
  @attributes
end

#end_pointObject (readonly)

Returns the value of attribute end_point.



7
8
9
# File 'lib/wego/client.rb', line 7

def end_point
  @end_point
end

Instance Method Details

#getObject



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

def get
  RestClient.get api_path, params: api_params
end

#urlObject



18
19
20
21
# File 'lib/wego/client.rb', line 18

def url
  params = api_params.map { |key, value| "#{key}=#{value}" }.join("&")
  [api_path, params].join("?")
end