Class: Files::IpAbuseEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/ip_abuse_entry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ IpAbuseEntry

Returns a new instance of IpAbuseEntry.



7
8
9
10
# File 'lib/files.com/models/ip_abuse_entry.rb', line 7

def initialize(attributes = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/ip_abuse_entry.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/ip_abuse_entry.rb', line 5

def options
  @options
end

Class Method Details

.all(params = {}, options = {}) ⇒ Object



70
71
72
73
# File 'lib/files.com/models/ip_abuse_entry.rb', line 70

def self.all(params = {}, options = {})
  list(params, options)
  nil
end

.create(params = {}, options = {}) ⇒ Object

Parameters:

ip (required) - string
list - string
hostname - string
reason - string


80
81
82
83
84
85
86
87
88
89
# File 'lib/files.com/models/ip_abuse_entry.rb', line 80

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: ip must be an String") if params[:ip] and !params[:ip].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: list must be an String") if params[:list] and !params[:list].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: hostname must be an String") if params[:hostname] and !params[:hostname].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: reason must be an String") if params[:reason] and !params[:reason].is_a?(String)
  raise MissingParameterError.new("Parameter missing: ip") unless params[:ip]

  Api.send_request("/ip_abuse_entries", :post, params, options)
  nil
end

.create_export(params = {}, options = {}) ⇒ Object



91
92
93
94
# File 'lib/files.com/models/ip_abuse_entry.rb', line 91

def self.create_export(params = {}, options = {})
  response, options = Api.send_request("/ip_abuse_entries/create_export", :post, params, options)
  Export.new(response.data, options)
end

.list(params = {}, options = {}) ⇒ Object

Parameters:

cursor - string - Used for pagination.  When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`.  Send one of those cursor value here to resume an existing list from the next available record.  Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
per_page - int64 - Number of records to show per page.  (Max: 10000, 1,000 or less is recommended).


62
63
64
65
66
67
68
# File 'lib/files.com/models/ip_abuse_entry.rb', line 62

def self.list(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)

  Api.send_request("/ip_abuse_entries", :get, params, options)
  nil
end

Instance Method Details

#hostnameObject

string



31
32
33
# File 'lib/files.com/models/ip_abuse_entry.rb', line 31

def hostname
  @attributes[:hostname]
end

#hostname=(value) ⇒ Object



35
36
37
# File 'lib/files.com/models/ip_abuse_entry.rb', line 35

def hostname=(value)
  @attributes[:hostname] = value
end

#ipObject

string



13
14
15
# File 'lib/files.com/models/ip_abuse_entry.rb', line 13

def ip
  @attributes[:ip]
end

#ip=(value) ⇒ Object



17
18
19
# File 'lib/files.com/models/ip_abuse_entry.rb', line 17

def ip=(value)
  @attributes[:ip] = value
end

#listObject

string



22
23
24
# File 'lib/files.com/models/ip_abuse_entry.rb', line 22

def list
  @attributes[:list]
end

#list=(value) ⇒ Object



26
27
28
# File 'lib/files.com/models/ip_abuse_entry.rb', line 26

def list=(value)
  @attributes[:list] = value
end

#reasonObject

string



40
41
42
# File 'lib/files.com/models/ip_abuse_entry.rb', line 40

def reason
  @attributes[:reason]
end

#reason=(value) ⇒ Object



44
45
46
# File 'lib/files.com/models/ip_abuse_entry.rb', line 44

def reason=(value)
  @attributes[:reason] = value
end

#saveObject



48
49
50
51
52
53
54
55
56
57
# File 'lib/files.com/models/ip_abuse_entry.rb', line 48

def save
  if @attributes[:id]
    raise NotImplementedError.new("The IpAbuseEntry object doesn't support updates.")
  else
    new_obj = IpAbuseEntry.create(@attributes, @options)
  end

  @attributes = new_obj.attributes
  true
end