Class: Fappu::Connection
- Inherits:
-
Object
- Object
- Fappu::Connection
- Defined in:
- lib/fappu/connection.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#body ⇒ Object
Returns the value of attribute body.
-
#documentation ⇒ Object
Returns the value of attribute documentation.
-
#response ⇒ Object
Returns the value of attribute response.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(settings = {}) ⇒ Connection
constructor
A new instance of Connection.
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_url ⇒ Object
Returns the value of attribute base_url.
4 5 6 |
# File 'lib/fappu/connection.rb', line 4 def base_url @base_url end |
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/fappu/connection.rb', line 4 def body @body end |
#documentation ⇒ Object
Returns the value of attribute documentation.
4 5 6 |
# File 'lib/fappu/connection.rb', line 4 def documentation @documentation end |
#response ⇒ Object
Returns the value of attribute response.
4 5 6 |
# File 'lib/fappu/connection.rb', line 4 def response @response end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/fappu/connection.rb', line 4 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/fappu/connection.rb', line 4 def url @url end |