Class: Courier::Models::PreviewDevice

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/courier/models/preview_device.rb,
sig/courier/models/preview_device.rbs

Defined Under Namespace

Modules: Category, Theme

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, app:, category:, name:, os:, os_version:, platform:, platform_version:, theme:) ⇒ Object

Some parameter documentations has been truncated, see Courier::Models::PreviewDevice for more details.

One mail app on one platform, operating system and theme that a preview can be rendered on. Reference data, identical for every workspace. Every field is always present; platform and platform_version are null where they do not apply.

Parameters:

  • id (String) —

    The device's identifier, used in device_ids when creating a device set or a ru

  • app (String) —

    The mail app. For webmail it is the service (outlook_com, gmail_com); for mo

  • category (Symbol, Courier::Models::PreviewDevice::Category) —

    Where the app runs.

  • name (String) —

    Display name. Render it as-is rather than parsing it. It is also what separates

  • os (String) —

    The operating system.

  • os_version (String) —

    The operating system's version. Always set.

  • platform (String, nil) —

    What the app runs on — the browser for webmail (chrome, edge, firefox), th

  • platform_version (String, nil) —

    Which one of the platform — the phone model for mobile (15_pro_max, 10). Nul

  • theme (Symbol, Courier::Models::PreviewDevice::Theme) —

    Whether the email is rendered in light or dark mode.



# File 'lib/courier/models/preview_device.rb', line 70

Instance Attribute Details

#app ⇒ String

The mail app. For webmail it is the service (outlook_com, gmail_com); for mobile the app (apple_mail, gmail); for desktop the app together with the version it is sold under (outlook_2019, outlook_microsoft_365, apple_mail_16), because that version is what separates one desktop Outlook from another.

Parameters:

  • value (String)

Returns:

  • (String)


21
# File 'lib/courier/models/preview_device.rb', line 21

required :app, String

#category ⇒ Symbol, Courier::Models::PreviewDevice::Category

Where the app runs.

Parameters:

  • value (Courier::Models::PreviewDevice::category)

Returns:



27
# File 'lib/courier/models/preview_device.rb', line 27

required :category, enum: -> { Courier::PreviewDevice::Category }

#id ⇒ String

The device's identifier, used in device_ids when creating a device set or a run.

Parameters:

  • value (String)

Returns:

  • (String)


11
# File 'lib/courier/models/preview_device.rb', line 11

required :id, String

#name ⇒ String

Display name. Render it as-is rather than parsing it. It is also what separates the two 120-dpi Outlook renders from their 100% siblings, which are otherwise identical field for field.

Parameters:

  • value (String)

Returns:

  • (String)


35
# File 'lib/courier/models/preview_device.rb', line 35

required :name, String

#os ⇒ String

The operating system.

Parameters:

  • value (String)

Returns:

  • (String)


41
# File 'lib/courier/models/preview_device.rb', line 41

required :os, String

#os_version ⇒ String

The operating system's version. Always set.

Parameters:

  • value (String)

Returns:

  • (String)


47
# File 'lib/courier/models/preview_device.rb', line 47

required :os_version, String

#platform ⇒ String?

What the app runs on — the browser for webmail (chrome, edge, firefox), the phone for mobile (iphone, pixel). Null for desktop, where the app runs on nothing but the OS.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


55
# File 'lib/courier/models/preview_device.rb', line 55

required :platform, String, nil?: true

#platform_version ⇒ String?

Which one of the platform — the phone model for mobile (15_pro_max, 10). Null for webmail, which always renders in the current browser, and for desktop.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


62
# File 'lib/courier/models/preview_device.rb', line 62

required :platform_version, String, nil?: true

#theme ⇒ Symbol, Courier::Models::PreviewDevice::Theme

Whether the email is rendered in light or dark mode.

Parameters:

  • value (Courier::Models::PreviewDevice::theme)

Returns:



68
# File 'lib/courier/models/preview_device.rb', line 68

required :theme, enum: -> { Courier::PreviewDevice::Theme }

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/courier/models/preview_device.rb', line 107

Instance Method Details

#to_hash ⇒ {

Returns:

  • ({)


47
# File 'sig/courier/models/preview_device.rbs', line 47

def to_hash: -> {