Class: Fappu::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/fappu/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings = {}) ⇒ Connection

Returns a new instance of Connection.



6
7
8
9
10
11
12
13
14
# File 'lib/fappu/connection.rb', line 6

def initialize(settings={})
  @base_url = settings[:base_url] || "https://api.fakku.net/index"

  # @response =  RestClient.get @base_url
  @response = URI.parse(@base_url).read

  @body = JSON.parse @response
  @title = @response['title']
end

Instance Attribute Details

#base_urlObject

Returns the value of attribute base_url.



4
5
6
# File 'lib/fappu/connection.rb', line 4

def base_url
  @base_url
end

#bodyObject

Returns the value of attribute body.



4
5
6
# File 'lib/fappu/connection.rb', line 4

def body
  @body
end

#documentationObject

Returns the value of attribute documentation.



4
5
6
# File 'lib/fappu/connection.rb', line 4

def documentation
  @documentation
end

#responseObject

Returns the value of attribute response.



4
5
6
# File 'lib/fappu/connection.rb', line 4

def response
  @response
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/fappu/connection.rb', line 4

def title
  @title
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/fappu/connection.rb', line 4

def url
  @url
end