Class: Rerout::CreateLinkInput
- Inherits:
-
Object
- Object
- Rerout::CreateLinkInput
- Defined in:
- lib/rerout/create_link_input.rb
Overview
Request body for ‘POST /v1/links`. Only `target_url` is required —everything else is optional and omitted from the payload when not set.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#domain_hostname ⇒ Object
readonly
Returns the value of attribute domain_hostname.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#seo_canonical_url ⇒ Object
readonly
Returns the value of attribute seo_canonical_url.
-
#seo_description ⇒ Object
readonly
Returns the value of attribute seo_description.
-
#seo_image_url ⇒ Object
readonly
Returns the value of attribute seo_image_url.
-
#seo_noindex ⇒ Object
readonly
Returns the value of attribute seo_noindex.
-
#seo_title ⇒ Object
readonly
Returns the value of attribute seo_title.
-
#target_url ⇒ Object
readonly
Returns the value of attribute target_url.
Instance Method Summary collapse
-
#initialize(target_url:, domain_hostname: nil, code: nil, expires_at: nil, seo_title: nil, seo_description: nil, seo_image_url: nil, seo_canonical_url: nil, seo_noindex: nil) ⇒ CreateLinkInput
constructor
A new instance of CreateLinkInput.
-
#to_h ⇒ Object
Serialize for the wire.
Constructor Details
#initialize(target_url:, domain_hostname: nil, code: nil, expires_at: nil, seo_title: nil, seo_description: nil, seo_image_url: nil, seo_canonical_url: nil, seo_noindex: nil) ⇒ CreateLinkInput
Returns a new instance of CreateLinkInput.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rerout/create_link_input.rb', line 20 def initialize(target_url:, domain_hostname: nil, code: nil, expires_at: nil, seo_title: nil, seo_description: nil, seo_image_url: nil, seo_canonical_url: nil, seo_noindex: nil) raise ArgumentError, 'target_url is required' if target_url.nil? || target_url.to_s.empty? @target_url = target_url @domain_hostname = domain_hostname @code = code @expires_at = expires_at @seo_title = seo_title @seo_description = seo_description @seo_image_url = seo_image_url @seo_canonical_url = seo_canonical_url @seo_noindex = seo_noindex freeze end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def code @code end |
#domain_hostname ⇒ Object (readonly)
Returns the value of attribute domain_hostname.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def domain_hostname @domain_hostname end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def expires_at @expires_at end |
#seo_canonical_url ⇒ Object (readonly)
Returns the value of attribute seo_canonical_url.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def seo_canonical_url @seo_canonical_url end |
#seo_description ⇒ Object (readonly)
Returns the value of attribute seo_description.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def seo_description @seo_description end |
#seo_image_url ⇒ Object (readonly)
Returns the value of attribute seo_image_url.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def seo_image_url @seo_image_url end |
#seo_noindex ⇒ Object (readonly)
Returns the value of attribute seo_noindex.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def seo_noindex @seo_noindex end |
#seo_title ⇒ Object (readonly)
Returns the value of attribute seo_title.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def seo_title @seo_title end |
#target_url ⇒ Object (readonly)
Returns the value of attribute target_url.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def target_url @target_url end |
Instance Method Details
#to_h ⇒ Object
Serialize for the wire. Fields are only included when set.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rerout/create_link_input.rb', line 38 def to_h hash = { 'target_url' => target_url } hash['domain_hostname'] = domain_hostname unless domain_hostname.nil? hash['code'] = code unless code.nil? hash['expires_at'] = expires_at unless expires_at.nil? hash['seo_title'] = seo_title unless seo_title.nil? hash['seo_description'] = seo_description unless seo_description.nil? hash['seo_image_url'] = seo_image_url unless seo_image_url.nil? hash['seo_canonical_url'] = seo_canonical_url unless seo_canonical_url.nil? hash['seo_noindex'] = seo_noindex unless seo_noindex.nil? hash end |