Class: Hateoas::MediaType::Request
- Inherits:
-
Object
- Object
- Hateoas::MediaType::Request
- Extended by:
- Forwardable
- Defined in:
- lib/hateoas.rb
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(url, media_type) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(url, media_type) ⇒ Request
Returns a new instance of Request.
41 42 43 44 |
# File 'lib/hateoas.rb', line 41 def initialize(url, media_type) @uri = URI(url) @media_type = media_type end |
Instance Method Details
#get ⇒ Object
46 47 48 49 50 51 |
# File 'lib/hateoas.rb', line 46 def get req = Net::HTTP::Get.new(request_uri) req['Accept'] = @media_type Net::HTTP.start(hostname, port) {|http| http.request(req) }.body end |