Class: Unit::Application::PatchApplicationRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/application/patch_application_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application_id, type, tags = nil) ⇒ PatchApplicationRequest

Returns a new instance of PatchApplicationRequest.

Parameters:

  • application_id (String)

    The application id

  • type (String)

    The type

  • tags (String) (defaults to: nil)

    The tags



14
15
16
17
18
# File 'lib/unit/models/application/patch_application_request.rb', line 14

def initialize(application_id, type, tags = nil)
  @application_id = application_id
  @type = type
  @tags = tags
end

Instance Attribute Details

#application_idObject (readonly)

Returns the value of attribute application_id.



9
10
11
# File 'lib/unit/models/application/patch_application_request.rb', line 9

def application_id
  @application_id
end

#tagsObject (readonly)

Returns the value of attribute tags.



9
10
11
# File 'lib/unit/models/application/patch_application_request.rb', line 9

def tags
  @tags
end

#typeObject (readonly)

Returns the value of attribute type.



9
10
11
# File 'lib/unit/models/application/patch_application_request.rb', line 9

def type
  @type
end

Instance Method Details

#to_json_apiString

Returns The JSON API payload.

Returns:

  • (String)

    The JSON API payload



21
22
23
24
25
26
27
28
29
30
# File 'lib/unit/models/application/patch_application_request.rb', line 21

def to_json_api
  payload = {
    data: {
      type: type,
      attributes: { tags: tags }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end