Class: Neuron::Schema::S3File

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/neuron-client/schema/s3_file.rb

Constant Summary collapse

SCHEMA =
self.new

Instance Method Summary collapse

Methods included from Common

#choice_of, #datetime, #errors, #id, included, #integer, #merged, #missing_or_null, #missing_or_null_or_empty_hash, #nonnull_string, #null, #nullable_string, #object_type, #object_type_or_null, #one_of, #parameters, #priority, #set_of, #slug, #timezone, #url, #uuid, #weight, #yes_no

Instance Method Details

#bucket(overrides = {}) ⇒ Object




36
37
38
39
40
41
42
43
44
45
# File 'lib/neuron-client/schema/s3_file.rb', line 36

def bucket(overrides={})
  merged({
    :description => "The name of the Amazon S3 bucket",
    :type => "string",
    :pattern => "^[a-z\\d]([a-z\\d\\-]*[a-z\\d])?(\\.[a-z\\d]([a-z\\d\\-]*[a-z\\d])?)*$",
    :minLength => 3,
    :maxLength => 63,
    :required => true
  }, overrides)
end

#createObject



13
14
15
16
# File 'lib/neuron-client/schema/s3_file.rb', line 13

def create
  @@create ||=
  object_type("s3_file", CORE_PROPERTIES)
end

#filename(overrides = {}) ⇒ Object



47
48
49
50
51
52
53
54
55
# File 'lib/neuron-client/schema/s3_file.rb', line 47

def filename(overrides={})
  merged({
    :description => "The full name of the file within the Amazon S3 bucket",
    :type => "string",
    :minLength => 3,
    :maxLength => 255,
    :required => true
  }, overrides)
end

#filesize(overrides = {}) ⇒ Object



57
58
59
60
61
62
63
64
65
# File 'lib/neuron-client/schema/s3_file.rb', line 57

def filesize(overrides={})
  merged({
    :type => %w(integer string null),
    :required => true,
    :minimum => 1,
    :exclusiveMinimum => false,
    :pattern => "^[1-9]\\d*$"
  }, overrides)
end

#indexObject



8
9
10
11
# File 'lib/neuron-client/schema/s3_file.rb', line 8

def index
  @@index ||=
  set_of(object_type("s3_file", merged(CORE_PROPERTIES, SHOW_PROPERTIES)))
end

#showObject



18
19
20
21
# File 'lib/neuron-client/schema/s3_file.rb', line 18

def show
  @@show ||=
  object_type("s3_file", merged(CORE_PROPERTIES, SHOW_PROPERTIES))
end

#updateObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/neuron-client/schema/s3_file.rb', line 23

def update
  @@update ||=
  object_type("s3_file", {
    :id => id,
    :bucket => SCHEMA.bucket(:required => false),
    :filename => SCHEMA.filename(:required => false),
    :filesize => SCHEMA.filesize(:required => false),
    :purpose => SCHEMA.choice_of(Neuron::Client::S3File::PURPOSE_CHOICES, :required => false)
  })
end