Class: ProximityBeacon::Attachment
Instance Method Summary
collapse
#as_json, camelcase_attr_accessor, #to_json, #update
Constructor Details
#initialize(*args) ⇒ Attachment
Returns a new instance of Attachment.
9
10
11
12
|
# File 'lib/proximity_beacon/attachment.rb', line 9
def initialize(*args)
self.namespaced_type = ""
super
end
|
Instance Method Details
#decoded_data ⇒ Object
30
31
32
|
# File 'lib/proximity_beacon/attachment.rb', line 30
def decoded_data
Base64.decode64(data)
end
|
#decoded_data=(value) ⇒ Object
34
35
36
|
# File 'lib/proximity_beacon/attachment.rb', line 34
def decoded_data=(value)
self.data = Base64.strict_encode64(value)
end
|
#id ⇒ Object
38
39
40
|
# File 'lib/proximity_beacon/attachment.rb', line 38
def id
name.split("/").last
end
|
#inspect ⇒ Object
42
43
44
|
# File 'lib/proximity_beacon/attachment.rb', line 42
def inspect
"#<Attachment name=\"#{name}\" namespaced_type=\"#{namespace}/#{type}\">"
end
|
#namespace ⇒ Object
14
15
16
|
# File 'lib/proximity_beacon/attachment.rb', line 14
def namespace
namespaced_type.split("/")[0]
end
|
#namespace=(value) ⇒ Object
18
19
20
|
# File 'lib/proximity_beacon/attachment.rb', line 18
def namespace=(value)
self.namespaced_type = [value, (type || "")].join("/")
end
|
#type ⇒ Object
22
23
24
|
# File 'lib/proximity_beacon/attachment.rb', line 22
def type
namespaced_type.split("/")[1]
end
|
#type=(value) ⇒ Object
26
27
28
|
# File 'lib/proximity_beacon/attachment.rb', line 26
def type=(value)
self.namespaced_type = [(namespace || ""), value].join("/")
end
|