Class: InfobipApi::PartOfUrlFieldConversionRule

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, part_index = nil) ⇒ PartOfUrlFieldConversionRule

Returns a new instance of PartOfUrlFieldConversionRule.



105
106
107
108
# File 'lib/infobipapi/objects.rb', line 105

def initialize(json_field_name=nil, part_index=nil)
    super(json_field_name)
    @part_index = part_index;
end

Instance Method Details

#from_json(value) ⇒ Object



110
111
112
113
114
115
116
117
118
# File 'lib/infobipapi/objects.rb', line 110

def from_json(value)
    if ! value
        return nil
    end

    parts = value.split('/')

    parts[@part_index]
end

#to_json(value) ⇒ Object



120
121
122
# File 'lib/infobipapi/objects.rb', line 120

def to_json(value)
    value
end