Module: TrailerVote::Api::Composable::Get
- Included in:
- TrailerVote::Api::Configuration, Issue::Find, Place::Children::Urls, Place::Find, Product::Find, Product::Image::Find, Product::Image::Urls, Product::Video::Find, Product::Video::Urls, PushRecipeAndroid, PushRecipeIos, VistaConfig
- Defined in:
- lib/trailer_vote/api/composable/get.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#data ⇒ Object
Return the decoded result inner object.
-
#etag ⇒ String, NilClass
Return the ETag value.
-
#links ⇒ Links
Return the Links for the result.
-
#to_h ⇒ Hash, Array
Decode the result via TypeRegistry.
-
#to_i ⇒ Numeric
Return the HTTP status.
Class Method Details
.included(base) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/trailer_vote/api/composable/get.rb', line 10 def self.included(base) base.include Common base.class_eval do attr_accessor :result end end |
Instance Method Details
#data ⇒ Object
Return the decoded result inner object
46 47 48 |
# File 'lib/trailer_vote/api/composable/get.rb', line 46 def data raise format('Missing implementation of #data in %<name>s', self.class.name) end |
#etag ⇒ String, NilClass
Return the ETag value
40 41 42 |
# File 'lib/trailer_vote/api/composable/get.rb', line 40 def etag call.result[Headers::ETAG] end |
#links ⇒ Links
Return the Links for the result
19 20 21 22 |
# File 'lib/trailer_vote/api/composable/get.rb', line 19 def links # TODO: or headers @links ||= Links.new(data[:_links]) end |
#to_h ⇒ Hash, Array
Decode the result via TypeRegistry. This also takes care of MediaTypes validation.
28 29 30 |
# File 'lib/trailer_vote/api/composable/get.rb', line 28 def to_h @to_h ||= TrailerVote::Api.decode(call.result) end |
#to_i ⇒ Numeric
Return the HTTP status
34 35 36 |
# File 'lib/trailer_vote/api/composable/get.rb', line 34 def to_i call.result.status end |