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



164
165
166
# File 'lib/files.com/models/child_site_management_policy.rb', line 164

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 excluded from this default policy.
child_site_ids - array(int64) - IDs of child sites explicitly assigned to this non-default policy.
default_policy - boolean - Whether this policy applies to child sites not explicitly assigned to another policy.
policy_type (required) - string - Type of policy.  Valid values: `settings`.
name - string - Name for this policy.
description - string - Description for this policy.


192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/files.com/models/child_site_management_policy.rb', line 192

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: child_site_ids must be an Array") if params[:child_site_ids] and !params[: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



229
230
231
232
233
234
235
236
237
# File 'lib/files.com/models/child_site_management_policy.rb', line 229

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



239
240
241
242
# File 'lib/files.com/models/child_site_management_policy.rb', line 239

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.


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

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



180
181
182
# File 'lib/files.com/models/child_site_management_policy.rb', line 180

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: 10000, 1,000 or less is recommended).


155
156
157
158
159
160
161
162
# File 'lib/files.com/models/child_site_management_policy.rb', line 155

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 excluded from this default policy.
child_site_ids - array(int64) - IDs of child sites explicitly assigned to this non-default policy.
default_policy - boolean - Whether this policy applies to child sites not explicitly assigned to another policy.
policy_type - string - Type of policy.  Valid values: `settings`.
name - string - Name for this policy.
description - string - Description for this policy.


213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/files.com/models/child_site_management_policy.rb', line 213

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: child_site_ids must be an Array") if params[:child_site_ids] and !params[: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

#child_site_idsObject

array(int64) - IDs of child sites explicitly assigned to this non-default policy.



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

def child_site_ids
  @attributes[:child_site_ids]
end

#child_site_ids=(value) ⇒ Object



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

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

#created_atObject

date-time - When this policy was created.



94
95
96
# File 'lib/files.com/models/child_site_management_policy.rb', line 94

def created_at
  @attributes[:created_at]
end

#default_policyObject

boolean - Whether this policy applies to child sites not explicitly assigned to another policy.



85
86
87
# File 'lib/files.com/models/child_site_management_policy.rb', line 85

def default_policy
  @attributes[:default_policy]
end

#default_policy=(value) ⇒ Object



89
90
91
# File 'lib/files.com/models/child_site_management_policy.rb', line 89

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

#delete(params = {}) ⇒ Object



126
127
128
129
130
131
132
133
134
# File 'lib/files.com/models/child_site_management_policy.rb', line 126

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



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

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



141
142
143
144
145
146
147
148
149
150
# File 'lib/files.com/models/child_site_management_policy.rb', line 141

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 excluded from this default policy.



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 excluded from this default policy.
child_site_ids - array(int64) - IDs of child sites explicitly assigned to this non-default policy.
default_policy - boolean - Whether this policy applies to child sites not explicitly assigned to another policy.
policy_type - string - Type of policy.  Valid values: `settings`.
name - string - Name for this policy.
description - string - Description for this policy.


111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/files.com/models/child_site_management_policy.rb', line 111

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: child_site_ids must be an Array") if params[:child_site_ids] and !params[: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.



99
100
101
# File 'lib/files.com/models/child_site_management_policy.rb', line 99

def updated_at
  @attributes[:updated_at]
end

#valueObject

object - Policy configuration data. Settings policies accept site settings plus an optional folder_behaviors array for parent-managed root behaviors on child sites. 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