Class: AkamaiApi::ECCU::UpdateAttributeRequest

Inherits:
BaseEditRequest show all
Defined in:
lib/akamai_api/eccu/update_attribute_request.rb

Overview

UpdateAttributeRequest is a generic request class that can be used to update an attribute of an ECCU request.

This class is used to update the AkamaiApi::ECCURequest#notes or the AkamaiApi::ECCURequest#email attributes

Examples:

begin
  res = AkamaiApi::ECCU::UpdateAttributeRequest.execute 12345, 'notes', 'my new notes'
  puts "Request completed: #{res}"
rescue AkamaiApi::ECCU::NotFound
  puts "No request can be found with the given code"
rescue AkamaiApi::Unauthorized
  puts "Invalid login credentials"
end

Instance Attribute Summary collapse

Attributes inherited from BaseEditRequest

#code

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseEditRequest

#with_soap_error_handling

Methods inherited from BaseRequest

#client, #client_call, #with_soap_error_handling

Constructor Details

#initialize(code, attribute) ⇒ UpdateAttributeRequest

Returns a new instance of UpdateAttributeRequest.

Parameters:

  • code (Fixnum)

    request code

  • attribute (String)

    name



32
33
34
35
# File 'lib/akamai_api/eccu/update_attribute_request.rb', line 32

def initialize code, attribute
  super code
  @attribute = attribute
end

Instance Attribute Details

#attributeString (readonly)

Returns attribute to update.

Returns:

  • (String)

    attribute to update



19
20
21
# File 'lib/akamai_api/eccu/update_attribute_request.rb', line 19

def attribute
  @attribute
end

Class Method Details

.execute(code, attribute, value) ⇒ true, false

Updates an attribute of an ECCU request

Parameters:

  • code (Fixnum)

    request code

  • attribute (String)

    name

  • value (String)

    new value to set

Returns:

  • (true, false)

    whether the request was successful or not



26
27
28
# File 'lib/akamai_api/eccu/update_attribute_request.rb', line 26

def self.execute code, attribute, value
  new(code, attribute).execute(value)
end

Instance Method Details

#execute(value) ⇒ true, false

Updates an attribute of an ECCU request

Parameters:

  • value (String)

    new value to set

Returns:

  • (true, false)

    whether the request was successful or not



40
41
42
43
44
# File 'lib/akamai_api/eccu/update_attribute_request.rb', line 40

def execute value
  with_soap_error_handling do
    client_call(:"set_#{attribute}", message: request_body(value).to_s)[:success]
  end
end

#request_body(notes) ⇒ SoapBody (protected)

Creates the request body filling it with all necessary arguments

Returns:



50
51
52
53
54
# File 'lib/akamai_api/eccu/update_attribute_request.rb', line 50

def request_body notes
  super do |block|
    block.string  attribute_for_soap,  notes
  end
end