Class: Plivo::Resources::EndpointInterface

Inherits:
Base::ResourceInterface show all
Defined in:
lib/plivo/resources/endpoints.rb

Constant Summary

Constants included from Utils

Utils::TYPE_WHITELIST

Instance Method Summary collapse

Methods included from Utils

GetSortedQueryParamString?, compute_signatureV3?, expected_type?, expected_value?, generate_url?, getMapFromQueryString?, is_one_among_string_url?, multi_valid_param?, raise_invalid_request, valid_account?, valid_date_format?, valid_mainaccount?, valid_multiple_destination_integers?, valid_multiple_destination_nos?, valid_param?, valid_range?, valid_signature?, valid_signatureV3?, valid_subaccount?, valid_url?

Constructor Details

#initialize(client, resource_list_json = nil) ⇒ EndpointInterface

Returns a new instance of EndpointInterface.



70
71
72
73
74
75
76
# File 'lib/plivo/resources/endpoints.rb', line 70

def initialize(client, resource_list_json = nil)
  @_name = 'Endpoint'
  @_resource_type = Endpoint
  @_identifier_string = 'endpoint_id'
  super
  @_is_voice_request = true
end

Instance Method Details

#create(username, password, alias_, app_id = nil) ⇒ Object

Parameters:

  • username (String)
  • password (String)
  • alias_ (String)
  • app_id (String) (defaults to: nil)


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/plivo/resources/endpoints.rb', line 69

class EndpointInterface < Base::ResourceInterface
  def initialize(client, resource_list_json = nil)
    @_name = 'Endpoint'
    @_resource_type = Endpoint
    @_identifier_string = 'endpoint_id'
    super
    @_is_voice_request = true
  end

  # @param [String] endpoint_id
  def get(endpoint_id)
    valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
    perform_get(endpoint_id)
  end

  # @param [String] username
  # @param [String] password
  # @param [String] alias_
  # @param [String] app_id
  def create(username, password, alias_, app_id = nil)
    valid_param?(:username, username, [String, Symbol], true)
    valid_param?(:password, password, [String, Symbol], true)
    valid_param?(:alias, alias_, [String, Symbol], true)

    params = {
      username: username,
      password: password,
      alias: alias_
    }

    params[:app_id] = app_id unless app_id.nil?

    perform_create(params)
  end

  def list
    perform_list
  end

  def each
    endpoint_list = list
    endpoint_list[:objects].each { |endpoint| yield endpoint }
  end

  # @param [String] endpoint_id
  # @param [Hash] options
  # @option options [String] :password The password for your endpoint username.
  # @option options [String] :alias Alias for this endpoint
  # @option options [String] :app_id The app_id of the application that is to be attached to this endpoint. If app_id is not specified, then the endpoint does not point to any application.
  def update(endpoint_id, options = nil)
    valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
    Endpoint.new(@_client,
                 resource_id: endpoint_id).update(options)
  end

  # @param [String] endpoint_id
  def delete(endpoint_id)
    valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
    Endpoint.new(@_client,
                 resource_id: endpoint_id).delete
  end
end

#delete(endpoint_id) ⇒ Object

Parameters:

  • endpoint_id (String)


125
126
127
128
129
# File 'lib/plivo/resources/endpoints.rb', line 125

def delete(endpoint_id)
  valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
  Endpoint.new(@_client,
               resource_id: endpoint_id).delete
end

#eachObject



108
109
110
111
# File 'lib/plivo/resources/endpoints.rb', line 108

def each
  endpoint_list = list
  endpoint_list[:objects].each { |endpoint| yield endpoint }
end

#get(endpoint_id) ⇒ Object

Parameters:

  • endpoint_id (String)


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/plivo/resources/endpoints.rb', line 69

class EndpointInterface < Base::ResourceInterface
  def initialize(client, resource_list_json = nil)
    @_name = 'Endpoint'
    @_resource_type = Endpoint
    @_identifier_string = 'endpoint_id'
    super
    @_is_voice_request = true
  end

  # @param [String] endpoint_id
  def get(endpoint_id)
    valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
    perform_get(endpoint_id)
  end

  # @param [String] username
  # @param [String] password
  # @param [String] alias_
  # @param [String] app_id
  def create(username, password, alias_, app_id = nil)
    valid_param?(:username, username, [String, Symbol], true)
    valid_param?(:password, password, [String, Symbol], true)
    valid_param?(:alias, alias_, [String, Symbol], true)

    params = {
      username: username,
      password: password,
      alias: alias_
    }

    params[:app_id] = app_id unless app_id.nil?

    perform_create(params)
  end

  def list
    perform_list
  end

  def each
    endpoint_list = list
    endpoint_list[:objects].each { |endpoint| yield endpoint }
  end

  # @param [String] endpoint_id
  # @param [Hash] options
  # @option options [String] :password The password for your endpoint username.
  # @option options [String] :alias Alias for this endpoint
  # @option options [String] :app_id The app_id of the application that is to be attached to this endpoint. If app_id is not specified, then the endpoint does not point to any application.
  def update(endpoint_id, options = nil)
    valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
    Endpoint.new(@_client,
                 resource_id: endpoint_id).update(options)
  end

  # @param [String] endpoint_id
  def delete(endpoint_id)
    valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
    Endpoint.new(@_client,
                 resource_id: endpoint_id).delete
  end
end

#listObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/plivo/resources/endpoints.rb', line 69

class EndpointInterface < Base::ResourceInterface
  def initialize(client, resource_list_json = nil)
    @_name = 'Endpoint'
    @_resource_type = Endpoint
    @_identifier_string = 'endpoint_id'
    super
    @_is_voice_request = true
  end

  # @param [String] endpoint_id
  def get(endpoint_id)
    valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
    perform_get(endpoint_id)
  end

  # @param [String] username
  # @param [String] password
  # @param [String] alias_
  # @param [String] app_id
  def create(username, password, alias_, app_id = nil)
    valid_param?(:username, username, [String, Symbol], true)
    valid_param?(:password, password, [String, Symbol], true)
    valid_param?(:alias, alias_, [String, Symbol], true)

    params = {
      username: username,
      password: password,
      alias: alias_
    }

    params[:app_id] = app_id unless app_id.nil?

    perform_create(params)
  end

  def list
    perform_list
  end

  def each
    endpoint_list = list
    endpoint_list[:objects].each { |endpoint| yield endpoint }
  end

  # @param [String] endpoint_id
  # @param [Hash] options
  # @option options [String] :password The password for your endpoint username.
  # @option options [String] :alias Alias for this endpoint
  # @option options [String] :app_id The app_id of the application that is to be attached to this endpoint. If app_id is not specified, then the endpoint does not point to any application.
  def update(endpoint_id, options = nil)
    valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
    Endpoint.new(@_client,
                 resource_id: endpoint_id).update(options)
  end

  # @param [String] endpoint_id
  def delete(endpoint_id)
    valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
    Endpoint.new(@_client,
                 resource_id: endpoint_id).delete
  end
end

#update(endpoint_id, options = nil) ⇒ Object

Parameters:

  • endpoint_id (String)
  • options (Hash) (defaults to: nil)

Options Hash (options):

  • :password (String)

    The password for your endpoint username.

  • :alias (String)

    Alias for this endpoint

  • :app_id (String)

    The app_id of the application that is to be attached to this endpoint. If app_id is not specified, then the endpoint does not point to any application.



118
119
120
121
122
# File 'lib/plivo/resources/endpoints.rb', line 118

def update(endpoint_id, options = nil)
  valid_param?(:endpoint_id, endpoint_id, [String, Symbol], true)
  Endpoint.new(@_client,
               resource_id: endpoint_id).update(options)
end