Class: InfobipApi::LastPartOfUrlFieldConversionRule

Inherits:
FieldConversionRule show all
Defined in:
lib/infobipapi/objects.rb

Instance Attribute Summary

Attributes inherited from FieldConversionRule

#json_field_name, #object_field_name

Instance Method Summary collapse

Constructor Details

#initialize(json_field_name: nil) ⇒ LastPartOfUrlFieldConversionRule

Returns a new instance of LastPartOfUrlFieldConversionRule.



84
85
86
# File 'lib/infobipapi/objects.rb', line 84

def initialize(json_field_name: nil)
    super(json_field_name)
end

Instance Method Details

#from_json(value) ⇒ Object



88
89
90
91
92
93
94
95
96
# File 'lib/infobipapi/objects.rb', line 88

def from_json(value)
    if ! value
        return nil
    end

    parts = value.split('/')

    parts[-1]
end

#to_json(value) ⇒ Object



98
99
100
# File 'lib/infobipapi/objects.rb', line 98

def to_json(value)
    value
end