Class: TRMNL::API::Models::Recipes::Data

Inherits:
Struct
  • Object
show all
Defined in:
lib/trmnl/api/models/recipes/data.rb

Overview

Models the data of the API response.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#authorObject

Returns the value of attribute author

Returns:

  • (Object)

    the current value of author



8
9
10
# File 'lib/trmnl/api/models/recipes/data.rb', line 8

def author
  @author
end

#custom_fieldsObject

Returns the value of attribute custom_fields

Returns:

  • (Object)

    the current value of custom_fields



8
9
10
# File 'lib/trmnl/api/models/recipes/data.rb', line 8

def custom_fields
  @custom_fields
end

#icon_content_typeObject

Returns the value of attribute icon_content_type

Returns:

  • (Object)

    the current value of icon_content_type



8
9
10
# File 'lib/trmnl/api/models/recipes/data.rb', line 8

def icon_content_type
  @icon_content_type
end

#icon_urlObject

Returns the value of attribute icon_url

Returns:

  • (Object)

    the current value of icon_url



8
9
10
# File 'lib/trmnl/api/models/recipes/data.rb', line 8

def icon_url
  @icon_url
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



8
9
10
# File 'lib/trmnl/api/models/recipes/data.rb', line 8

def id
  @id
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



8
9
10
# File 'lib/trmnl/api/models/recipes/data.rb', line 8

def name
  @name
end

#published_atObject

Returns the value of attribute published_at

Returns:

  • (Object)

    the current value of published_at



8
9
10
# File 'lib/trmnl/api/models/recipes/data.rb', line 8

def published_at
  @published_at
end

#screenshot_urlObject

Returns the value of attribute screenshot_url

Returns:

  • (Object)

    the current value of screenshot_url



8
9
10
# File 'lib/trmnl/api/models/recipes/data.rb', line 8

def screenshot_url
  @screenshot_url
end

#statisticsObject

Returns the value of attribute statistics

Returns:

  • (Object)

    the current value of statistics



8
9
10
# File 'lib/trmnl/api/models/recipes/data.rb', line 8

def statistics
  @statistics
end

Class Method Details

.for(**attributes) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/trmnl/api/models/recipes/data.rb', line 19

def self.for(**attributes)
  new(
    **attributes.merge!(
      author: Author.for(**attributes.delete(:author_bio)),
      statistics: Statistics[**attributes.delete(:stats)]
    )
  )
end