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.
40 41 42 43 |
# File 'lib/hateoas.rb', line 40 def initialize(url, media_type) @uri = URI(url) @media_type = media_type end |
Instance Method Details
#get ⇒ Object
45 46 47 48 49 50 |
# File 'lib/hateoas.rb', line 45 def get req = Net::HTTP::Get.new(request_uri) req['Accept'] = @media_type Net::HTTP.start(hostname, port) {|http| http.request(req) }.body end |