Class: Files::ChildSiteManagementPolicy

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ChildSiteManagementPolicy.



7
8
9
10
# File 'lib/files.com/models/child_site_management_policy.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/child_site_management_policy.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

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



143
144
145
# File 'lib/files.com/models/child_site_management_policy.rb', line 143

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

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

Parameters:

value - object - Policy configuration data. Attributes differ by policy type. For more information, refer to the Value Hash section of the developer documentation.
skip_child_site_ids - array(int64) - IDs of child sites that this policy has been exempted from. If `skip_child_site_ids` is empty, the policy will be applied to all child sites. To apply a policy to a child site that has been exempted, remove it from `skip_child_site_ids` or set it to an empty array (`[]`).
policy_type (required) - string - Type of policy.  Valid values: `settings`.
name - string - Name for this policy.
description - string - Description for this policy.


169
170
171
172
173
174
175
176
177
178
179
# File 'lib/files.com/models/child_site_management_policy.rb', line 169

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: value must be an Hash") if params[:value] and !params[:value].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: skip_child_site_ids must be an Array") if params[:skip_child_site_ids] and !params[:skip_child_site_ids].is_a?(Array)
  raise InvalidParameterError.new("Bad parameter: policy_type must be an String") if params[:policy_type] and !params[:policy_type].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
  raise MissingParameterError.new("Parameter missing: policy_type") unless params[:policy_type]

  response, options = Api.send_request("/child_site_management_policies", :post, params, options)
  ChildSiteManagementPolicy.new(response.data, options)
end

.delete(id, params = {}, options = {}) ⇒ Object



202
203
204
205
206
207
208
209
210
# File 'lib/files.com/models/child_site_management_policy.rb', line 202

def self.delete(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/child_site_management_policies/#{params[:id]}", :delete, params, options)
  nil
end

.destroy(id, params = {}, options = {}) ⇒ Object



212
213
214
215
# File 'lib/files.com/models/child_site_management_policy.rb', line 212

def self.destroy(id, params = {}, options = {})
  delete(id, params, options)
  nil
end

.find(id, params = {}, options = {}) ⇒ Object

Parameters:

id (required) - int64 - Child Site Management Policy ID.


149
150
151
152
153
154
155
156
157
# File 'lib/files.com/models/child_site_management_policy.rb', line 149

def self.find(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/child_site_management_policies/#{params[:id]}", :get, params, options)
  ChildSiteManagementPolicy.new(response.data, options)
end

.get(id, params = {}, options = {}) ⇒ Object



159
160
161
# File 'lib/files.com/models/child_site_management_policy.rb', line 159

def self.get(id, params = {}, options = {})
  find(id, params, 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: 10,000, 1,000 or less is recommended).


134
135
136
137
138
139
140
141
# File 'lib/files.com/models/child_site_management_policy.rb', line 134

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)

  List.new(ChildSiteManagementPolicy, params) do
    Api.send_request("/child_site_management_policies", :get, params, options)
  end
end

.update(id, params = {}, options = {}) ⇒ Object

Parameters:

value - object - Policy configuration data. Attributes differ by policy type. For more information, refer to the Value Hash section of the developer documentation.
skip_child_site_ids - array(int64) - IDs of child sites that this policy has been exempted from. If `skip_child_site_ids` is empty, the policy will be applied to all child sites. To apply a policy to a child site that has been exempted, remove it from `skip_child_site_ids` or set it to an empty array (`[]`).
policy_type - string - Type of policy.  Valid values: `settings`.
name - string - Name for this policy.
description - string - Description for this policy.


187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/files.com/models/child_site_management_policy.rb', line 187

def self.update(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: value must be an Hash") if params[:value] and !params[:value].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: skip_child_site_ids must be an Array") if params[:skip_child_site_ids] and !params[:skip_child_site_ids].is_a?(Array)
  raise InvalidParameterError.new("Bad parameter: policy_type must be an String") if params[:policy_type] and !params[:policy_type].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/child_site_management_policies/#{params[:id]}", :patch, params, options)
  ChildSiteManagementPolicy.new(response.data, options)
end

Instance Method Details

#applied_child_site_idsObject

array(int64) - IDs of child sites that this policy has been applied to. This field is read-only.



58
59
60
# File 'lib/files.com/models/child_site_management_policy.rb', line 58

def applied_child_site_ids
  @attributes[:applied_child_site_ids]
end

#applied_child_site_ids=(value) ⇒ Object



62
63
64
# File 'lib/files.com/models/child_site_management_policy.rb', line 62

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

#created_atObject

date-time - When this policy was created.



76
77
78
# File 'lib/files.com/models/child_site_management_policy.rb', line 76

def created_at
  @attributes[:created_at]
end

#delete(params = {}) ⇒ Object



105
106
107
108
109
110
111
112
113
# File 'lib/files.com/models/child_site_management_policy.rb', line 105

def delete(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/child_site_management_policies/#{@attributes[:id]}", :delete, params, @options)
end

#descriptionObject

string - Description for this policy.



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

def description
  @attributes[:description]
end

#description=(value) ⇒ Object



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

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

#destroy(params = {}) ⇒ Object



115
116
117
118
# File 'lib/files.com/models/child_site_management_policy.rb', line 115

def destroy(params = {})
  delete(params)
  nil
end

#idObject

int64 - Policy ID.



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

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



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

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

#nameObject

string - Name for this policy.



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

def name
  @attributes[:name]
end

#name=(value) ⇒ Object



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

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

#policy_typeObject

string - Type of policy. Valid values: ‘settings`.



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

def policy_type
  @attributes[:policy_type]
end

#policy_type=(value) ⇒ Object



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

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

#saveObject



120
121
122
123
124
125
126
127
128
129
# File 'lib/files.com/models/child_site_management_policy.rb', line 120

def save
  if @attributes[:id]
    new_obj = update(@attributes)
  else
    new_obj = ChildSiteManagementPolicy.create(@attributes, @options)
  end

  @attributes = new_obj.attributes
  true
end

#skip_child_site_idsObject

array(int64) - IDs of child sites that this policy has been exempted from. If ‘skip_child_site_ids` is empty, the policy will be applied to all child sites. To apply a policy to a child site that has been exempted, remove it from `skip_child_site_ids` or set it to an empty array (`[]`).



67
68
69
# File 'lib/files.com/models/child_site_management_policy.rb', line 67

def skip_child_site_ids
  @attributes[:skip_child_site_ids]
end

#skip_child_site_ids=(value) ⇒ Object



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

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

#update(params = {}) ⇒ Object

Parameters:

value - object - Policy configuration data. Attributes differ by policy type. For more information, refer to the Value Hash section of the developer documentation.
skip_child_site_ids - array(int64) - IDs of child sites that this policy has been exempted from. If `skip_child_site_ids` is empty, the policy will be applied to all child sites. To apply a policy to a child site that has been exempted, remove it from `skip_child_site_ids` or set it to an empty array (`[]`).
policy_type - string - Type of policy.  Valid values: `settings`.
name - string - Name for this policy.
description - string - Description for this policy.


91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/files.com/models/child_site_management_policy.rb', line 91

def update(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: skip_child_site_ids must be an Array") if params[:skip_child_site_ids] and !params[:skip_child_site_ids].is_a?(Array)
  raise InvalidParameterError.new("Bad parameter: policy_type must be an String") if params[:policy_type] and !params[:policy_type].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/child_site_management_policies/#{@attributes[:id]}", :patch, params, @options)
end

#updated_atObject

date-time - When this policy was last updated.



81
82
83
# File 'lib/files.com/models/child_site_management_policy.rb', line 81

def updated_at
  @attributes[:updated_at]
end

#valueObject

object - Policy configuration data. Attributes differ by policy type. For more information, refer to the Value Hash section of the developer documentation.



49
50
51
# File 'lib/files.com/models/child_site_management_policy.rb', line 49

def value
  @attributes[:value]
end

#value=(value) ⇒ Object



53
54
55
# File 'lib/files.com/models/child_site_management_policy.rb', line 53

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