Class: Pinnacle::PointOfContact

Inherits:
Object
  • Object
show all
Defined in:
lib/rcs/types/point_of_contact.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(poc_name:, poc_title:, poc_email:, additional_properties: nil) ⇒ Pinnacle::PointOfContact

Parameters:

  • poc_name (String)

    Point of contact’s name.

  • poc_title (String)

    Point of contact’s title.

  • poc_email (String)

    Point of contact’s email address.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



27
28
29
30
31
32
33
# File 'lib/rcs/types/point_of_contact.rb', line 27

def initialize(poc_name:, poc_title:, poc_email:, additional_properties: nil)
  @poc_name = poc_name
  @poc_title = poc_title
  @poc_email = poc_email
  @additional_properties = additional_properties
  @_field_set = { "pocName": poc_name, "pocTitle": poc_title, "pocEmail": poc_email }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



15
16
17
# File 'lib/rcs/types/point_of_contact.rb', line 15

def additional_properties
  @additional_properties
end

#poc_emailString (readonly)

Returns Point of contact’s email address.

Returns:

  • (String)

    Point of contact’s email address.



13
14
15
# File 'lib/rcs/types/point_of_contact.rb', line 13

def poc_email
  @poc_email
end

#poc_nameString (readonly)

Returns Point of contact’s name.

Returns:

  • (String)

    Point of contact’s name.



9
10
11
# File 'lib/rcs/types/point_of_contact.rb', line 9

def poc_name
  @poc_name
end

#poc_titleString (readonly)

Returns Point of contact’s title.

Returns:

  • (String)

    Point of contact’s title.



11
12
13
# File 'lib/rcs/types/point_of_contact.rb', line 11

def poc_title
  @poc_title
end

Class Method Details

.from_json(json_object:) ⇒ Pinnacle::PointOfContact

Deserialize a JSON object to an instance of PointOfContact

Parameters:

  • json_object (String)

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/rcs/types/point_of_contact.rb', line 39

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  poc_name = parsed_json["pocName"]
  poc_title = parsed_json["pocTitle"]
  poc_email = parsed_json["pocEmail"]
  new(
    poc_name: poc_name,
    poc_title: poc_title,
    poc_email: poc_email,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


66
67
68
69
70
# File 'lib/rcs/types/point_of_contact.rb', line 66

def self.validate_raw(obj:)
  obj.poc_name.is_a?(String) != false || raise("Passed value for field obj.poc_name is not the expected type, validation failed.")
  obj.poc_title.is_a?(String) != false || raise("Passed value for field obj.poc_title is not the expected type, validation failed.")
  obj.poc_email.is_a?(String) != false || raise("Passed value for field obj.poc_email is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of PointOfContact to a JSON object

Returns:

  • (String)


56
57
58
# File 'lib/rcs/types/point_of_contact.rb', line 56

def to_json(*_args)
  @_field_set&.to_json
end