Class: W3cApi::Models::CallForTranslation
- Defined in:
- lib/w3c_api/models/call_for_translation.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#translations(client = nil) ⇒ Object
Get translations for this call for translation.
Methods inherited from Base
Class Method Details
.from_response(response) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/w3c_api/models/call_for_translation.rb', line 40 def self.from_response(response) transformed_response = transform_keys(response) cft = new transformed_response.each do |key, value| case key when :_links links = value.each_with_object({}) do |(link_name, link_data), acc| acc[link_name] = Link.new(href: link_data[:href], title: link_data[:title]) end cft._links = CallForTranslationLinks.new(links) else cft.send("#{key}=", value) if cft.respond_to?("#{key}=") end end cft end |
Instance Method Details
#translations(client = nil) ⇒ Object
Get translations for this call for translation
34 35 36 37 38 |
# File 'lib/w3c_api/models/call_for_translation.rb', line 34 def translations(client = nil) return nil unless client && _links&.translations client.call_for_translation_translations(uri) end |