Class: Calligraphy::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/calligraphy/resource.rb

Direct Known Subclasses

FileResource

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource: nil, req: nil, mount: nil, root_dir: nil) ⇒ Resource

Returns a new instance of Resource.



6
7
8
9
10
11
# File 'lib/calligraphy/resource.rb', line 6

def initialize(resource: nil, req: nil, mount: nil, root_dir: nil)
  @full_request_path = req&.original_url
  @mount_point = mount || req&.path&.tap { |s| s.slice! resource }
  @request_body = req&.body&.read || ''
  @request_path = mount.nil? ? resource : resource.split(mount)[-1]
end

Instance Attribute Details

#client_nonceObject

Returns the value of attribute client_nonce.



3
4
5
# File 'lib/calligraphy/resource.rb', line 3

def client_nonce
  @client_nonce
end

#contentsObject

Returns the value of attribute contents.



3
4
5
# File 'lib/calligraphy/resource.rb', line 3

def contents
  @contents
end

#full_request_pathObject (readonly)

Returns the value of attribute full_request_path.



4
5
6
# File 'lib/calligraphy/resource.rb', line 4

def full_request_path
  @full_request_path
end

#mount_pointObject (readonly)

Returns the value of attribute mount_point.



4
5
6
# File 'lib/calligraphy/resource.rb', line 4

def mount_point
  @mount_point
end

#request_bodyObject (readonly)

Returns the value of attribute request_body.



4
5
6
# File 'lib/calligraphy/resource.rb', line 4

def request_body
  @request_body
end

#request_pathObject (readonly)

Returns the value of attribute request_path.



4
5
6
# File 'lib/calligraphy/resource.rb', line 4

def request_path
  @request_path
end

#root_dirObject (readonly)

Returns the value of attribute root_dir.



4
5
6
# File 'lib/calligraphy/resource.rb', line 4

def root_dir
  @root_dir
end

#updated_atObject

Returns the value of attribute updated_at.



3
4
5
# File 'lib/calligraphy/resource.rb', line 3

def updated_at
  @updated_at
end

Instance Method Details

#ancestor_exist?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplemented)


13
14
15
# File 'lib/calligraphy/resource.rb', line 13

def ancestor_exist?
  raise NotImplemented
end

#can_copy?(options) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplemented)


17
18
19
# File 'lib/calligraphy/resource.rb', line 17

def can_copy?(options)
  raise NotImplemented
end

#collection?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplemented)


21
22
23
# File 'lib/calligraphy/resource.rb', line 21

def collection?
  raise NotImplemented
end

#copy(options) ⇒ Object

Raises:

  • (NotImplemented)


25
26
27
# File 'lib/calligraphy/resource.rb', line 25

def copy(options)
  raise NotImplemented
end

#create_collectionObject

Raises:

  • (NotImplemented)


29
30
31
# File 'lib/calligraphy/resource.rb', line 29

def create_collection
  raise NotImplemented
end

#delete_collectionObject

Raises:

  • (NotImplemented)


33
34
35
# File 'lib/calligraphy/resource.rb', line 33

def delete_collection
  raise NotImplemented
end

#etagObject

Raises:

  • (NotImplemented)


37
38
39
# File 'lib/calligraphy/resource.rb', line 37

def etag
  raise NotImplemented
end

#exists?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplemented)


41
42
43
# File 'lib/calligraphy/resource.rb', line 41

def exists?
  raise NotImplemented
end

#lock(nodes, depth = 'infinity') ⇒ Object

Raises:

  • (NotImplemented)


45
46
47
# File 'lib/calligraphy/resource.rb', line 45

def lock(nodes, depth='infinity')
  raise NotImplemented
end

#lock_is_exclusive?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplemented)


49
50
51
# File 'lib/calligraphy/resource.rb', line 49

def lock_is_exclusive?
  raise NotImplemented
end

#lock_tokensObject

Raises:

  • (NotImplemented)


53
54
55
# File 'lib/calligraphy/resource.rb', line 53

def lock_tokens
  raise NotImplemented
end

#locked?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplemented)


57
58
59
# File 'lib/calligraphy/resource.rb', line 57

def locked?
  raise NotImplemented
end

#locked_to_user?(headers = nil) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplemented)


61
62
63
# File 'lib/calligraphy/resource.rb', line 61

def locked_to_user?(headers=nil)
  raise NotImplemented
end

#propfind(nodes) ⇒ Object

Raises:

  • (NotImplemented)


65
66
67
# File 'lib/calligraphy/resource.rb', line 65

def propfind(nodes)
  raise NotImplemented
end

#proppatch(nodes) ⇒ Object

Raises:

  • (NotImplemented)


69
70
71
# File 'lib/calligraphy/resource.rb', line 69

def proppatch(nodes)
  raise NotImplemented
end

#readObject

Raises:

  • (NotImplemented)


73
74
75
# File 'lib/calligraphy/resource.rb', line 73

def read
  raise NotImplemented
end

#readable?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/calligraphy/resource.rb', line 77

def readable?
  exists? && !collection?
end

#refresh_lockObject

Raises:

  • (NotImplemented)


81
82
83
# File 'lib/calligraphy/resource.rb', line 81

def refresh_lock
  raise NotImplemented
end

#unlock(token) ⇒ Object

Raises:

  • (NotImplemented)


85
86
87
# File 'lib/calligraphy/resource.rb', line 85

def unlock(token)
  raise NotImplemented
end

#write(contents = @request_body.to_s) ⇒ Object

Raises:

  • (NotImplemented)


89
90
91
# File 'lib/calligraphy/resource.rb', line 89

def write(contents=@request_body.to_s)
  raise NotImplemented
end