Class: CF::CustomTaskForm
- Inherits:
-
Object
- Object
- CF::CustomTaskForm
- Includes:
- Client
- Defined in:
- lib/cf/custom_task_form.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Contains Error message if any.
-
#instruction ⇒ Object
Description of “custom_instruction” object, e.g.
-
#raw_css ⇒ Object
raw_css is an attribute to store the custom css contents.
-
#raw_html ⇒ Object
raw_html is an attribute to store the custom html contents.
-
#raw_javascript ⇒ Object
raw_javascript is an attribute to store the custom javascript contents.
-
#station ⇒ Object
station attribute is required for association with custom_from object.
-
#title ⇒ Object
Title of “custom_instruction” object, e.g.
Class Method Summary collapse
-
.create(form) ⇒ Object
Initializes a new CustomForm within block using Variable ===Usage custom_instruction.create(hash):.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CustomTaskForm
constructor
Initializes a new CustomForm ===Usage custom_instruction.new(hash):.
-
#to_s ⇒ Object
:nodoc:.
Constructor Details
#initialize(options = {}) ⇒ CustomTaskForm
Initializes a new CustomForm
Usage custom_instruction.new(hash):
html = 'html_content'
css = 'css_content'
javascript = 'javascript_content'
instruction = CF::CustomTaskForm.new({:title => "Enter text from a business card image", :instruction => "Describe", :raw_html => html, :raw_css => css, :raw_javascript => javascript})
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/cf/custom_task_form.rb', line 34 def initialize(={}) @station = [:station] @title = [:title] @instruction = [:instruction] @raw_html = [:raw_html] @raw_css = [:raw_css] @raw_javascript = [:raw_javascript] if @station resp = self.class.post("/lines/#{CF.account_name}/#{@station.line_title.downcase}/stations/#{@station.index}/form.json", :form => {:title => @title, :instruction => @instruction, :_type => "CustomTaskForm", :raw_html => @raw_html, :raw_css => @raw_css, :raw_javascript => @raw_javascript}) resp.to_hash.each_pair do |k,v| self.send("#{k}=",v) if self.respond_to?(k) end if resp.code != 200 self.errors = resp.error. end @station.form = self return self end end |
Instance Attribute Details
#errors ⇒ Object
Contains Error message if any
24 25 26 |
# File 'lib/cf/custom_task_form.rb', line 24 def errors @errors end |
#instruction ⇒ Object
Description of “custom_instruction” object, e.g. :description => “description for title of custom_instruction”
9 10 11 |
# File 'lib/cf/custom_task_form.rb', line 9 def instruction @instruction end |
#raw_css ⇒ Object
raw_css is an attribute to store the custom css contents
15 16 17 |
# File 'lib/cf/custom_task_form.rb', line 15 def raw_css @raw_css end |
#raw_html ⇒ Object
raw_html is an attribute to store the custom html contents
12 13 14 |
# File 'lib/cf/custom_task_form.rb', line 12 def raw_html @raw_html end |
#raw_javascript ⇒ Object
raw_javascript is an attribute to store the custom javascript contents
18 19 20 |
# File 'lib/cf/custom_task_form.rb', line 18 def raw_javascript @raw_javascript end |
#station ⇒ Object
station attribute is required for association with custom_from object
21 22 23 |
# File 'lib/cf/custom_task_form.rb', line 21 def station @station end |
#title ⇒ Object
Title of “custom_instruction” object, e.g. :title => “title_name of custom_instruction”
6 7 8 |
# File 'lib/cf/custom_task_form.rb', line 6 def title @title end |
Class Method Details
.create(form) ⇒ Object
Initializes a new CustomForm within block using Variable
Usage custom_instruction.create(hash):
html = 'html_content'
css = 'css_content'
javascript = 'javascript_content'
instruction = CF::CustomTaskForm.create({:title => "Enter text from a business card image", :instruction => "Describe", :raw_html => html, :raw_css => css, :raw_javascript => javascript})
62 63 64 |
# File 'lib/cf/custom_task_form.rb', line 62 def self.create(form) instruction = CustomTaskForm.new(form) end |
Instance Method Details
#to_s ⇒ Object
:nodoc:
66 67 68 |
# File 'lib/cf/custom_task_form.rb', line 66 def to_s # :nodoc: "{:title => #{self.title}, :instruction => #{self.instruction}, :raw_html => #{self.raw_html}, :raw_css => #{self.raw_css}, :raw_javascript => #{self.raw_javascript}, :errors => #{self.errors}}" end |