Class: AskAwesomely::Picture

Inherits:
Object
  • Object
show all
Defined in:
lib/ask_awesomely/picture.rb

Constant Summary collapse

DEFAULT_TYPE =
:choice
PICTURE_TYPES =
[
  :choice
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_or_url, type: DEFAULT_TYPE) ⇒ Picture

Returns a new instance of Picture.



12
13
14
15
# File 'lib/ask_awesomely/picture.rb', line 12

def initialize(file_or_url, type: DEFAULT_TYPE)
  @file_or_url = file_or_url
  @type = type
end

Instance Attribute Details

#file_or_urlObject (readonly)

Returns the value of attribute file_or_url.



4
5
6
# File 'lib/ask_awesomely/picture.rb', line 4

def file_or_url
  @file_or_url
end

#public_urlObject (readonly)

Returns the value of attribute public_url.



4
5
6
# File 'lib/ask_awesomely/picture.rb', line 4

def public_url
  @public_url
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/ask_awesomely/picture.rb', line 4

def type
  @type
end

#typeform_idObject (readonly)

Returns the value of attribute typeform_id.



4
5
6
# File 'lib/ask_awesomely/picture.rb', line 4

def typeform_id
  @typeform_id
end

Instance Method Details

#to_jsonObject



30
31
32
33
34
# File 'lib/ask_awesomely/picture.rb', line 30

def to_json(*)
  {
    url: public_url,
  }.to_json
end