Class: Twilio::REST::Accounts::V1::MessagingGeopermissionsList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/accounts/v1/messaging_geopermissions.rb

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ MessagingGeopermissionsList

Initialize the MessagingGeopermissionsList

Parameters:

  • version (Version)

    Version that contains the resource



26
27
28
29
30
31
32
# File 'lib/twilio-ruby/rest/accounts/v1/messaging_geopermissions.rb', line 26

def initialize(version)
    super(version)
    # Path Solution
    @solution = {  }
    @uri = "/Messaging/GeoPermissions"
    
end

Instance Method Details

#fetch(country_code: :unset) ⇒ MessagingGeopermissionsInstance

Fetch the MessagingGeopermissionsInstance

Parameters:

  • country_code (String) (defaults to: :unset)

    The country code to filter the geo permissions. If provided, only the geo permission for the specified country will be returned.

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/twilio-ruby/rest/accounts/v1/messaging_geopermissions.rb', line 37

def fetch(
    country_code: :unset
)

    params = Twilio::Values.of({
        'CountryCode' => country_code,
    })
    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, params: params, headers: headers)
    MessagingGeopermissionsInstance.new(
        @version,
        payload,
    )
end

#to_sObject

Provide a user friendly representation



86
87
88
# File 'lib/twilio-ruby/rest/accounts/v1/messaging_geopermissions.rb', line 86

def to_s
    '#<Twilio.Accounts.V1.MessagingGeopermissionsList>'
end

#update(permissions: nil) ⇒ MessagingGeopermissionsInstance

Update the MessagingGeopermissionsInstance

Parameters:

  • permissions (Array[Hash]) (defaults to: nil)

    A list of objects where each object represents the Geo Permission to be updated. Each object contains the following fields: ‘country_code`, unique code for each country of Geo Permission; `type`, permission type of the Geo Permission i.e. country; `enabled`, configure true for enabling the Geo Permission, false for disabling the Geo Permission.

Returns:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/twilio-ruby/rest/accounts/v1/messaging_geopermissions.rb', line 61

def update(
    permissions: nil
)

    data = Twilio::Values.of({
        'Permissions' => Twilio.serialize_list(permissions) { |e| Twilio.serialize_object(e) },
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('PATCH', @uri, data: data, headers: headers)
    MessagingGeopermissionsInstance.new(
        @version,
        payload,
    )
end