Class: Bestchange::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/bestchange/api.rb

Constant Summary collapse

BASE_URI =
'http://api.bestchange.ru/info.zip'
BASE_CONNECTION =
Net::HTTP.new(URI(BASE_URI).host, URI(BASE_URI).port)
BASE_REQUEST =
Net::HTTP::Get.new(URI(BASE_URI))

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conn = BASE_CONNECTION) ⇒ Api

Returns a new instance of Api.



15
16
17
# File 'lib/bestchange/api.rb', line 15

def initialize(conn = BASE_CONNECTION)
  @conn = conn
end

Instance Attribute Details

#connObject (readonly)

Returns the value of attribute conn.



19
20
21
# File 'lib/bestchange/api.rb', line 19

def conn
  @conn
end

Instance Method Details

#request(request = BASE_REQUEST) ⇒ Object



21
22
23
# File 'lib/bestchange/api.rb', line 21

def request(request = BASE_REQUEST)
  conn.request(request)
end