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
-
#ab_variants ⇒ Object
readonly
Returns the value of attribute ab_variants.
-
#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.
-
#max_clicks ⇒ Object
readonly
Returns the value of attribute max_clicks.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#routing_rules ⇒ Object
readonly
Returns the value of attribute routing_rules.
-
#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.
-
#track_conversions ⇒ Object
readonly
Returns the value of attribute track_conversions.
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, password: nil, max_clicks: nil, track_conversions: nil, routing_rules: nil, ab_variants: 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, password: nil, max_clicks: nil, track_conversions: nil, routing_rules: nil, ab_variants: nil) ⇒ CreateLinkInput
Returns a new instance of CreateLinkInput.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rerout/create_link_input.rb', line 29 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, password: nil, max_clicks: nil, track_conversions: nil, routing_rules: nil, ab_variants: 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 @password = password @max_clicks = max_clicks @track_conversions = track_conversions @routing_rules = routing_rules @ab_variants = ab_variants freeze end |
Instance Attribute Details
#ab_variants ⇒ Object (readonly)
Returns the value of attribute ab_variants.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def ab_variants @ab_variants end |
#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 |
#max_clicks ⇒ Object (readonly)
Returns the value of attribute max_clicks.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def max_clicks @max_clicks end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def password @password end |
#routing_rules ⇒ Object (readonly)
Returns the value of attribute routing_rules.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def routing_rules @routing_rules 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 |
#track_conversions ⇒ Object (readonly)
Returns the value of attribute track_conversions.
7 8 9 |
# File 'lib/rerout/create_link_input.rb', line 7 def track_conversions @track_conversions end |
Instance Method Details
#to_h ⇒ Object
Serialize for the wire. Fields are only included when set.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rerout/create_link_input.rb', line 54 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['password'] = password unless password.nil? hash['max_clicks'] = max_clicks unless max_clicks.nil? hash['track_conversions'] = track_conversions unless track_conversions.nil? hash['routing_rules'] = routing_rules.map { |r| InputSerialization.rule_hash(r) } unless routing_rules.nil? hash['ab_variants'] = ab_variants.map { |v| InputSerialization.variant_hash(v) } unless ab_variants.nil? hash end |