Class: CF::OutputFormat
- Inherits:
-
Object
- Object
- CF::OutputFormat
- Includes:
- Client
- Defined in:
- lib/cf/output_format.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Contains error message if any.
-
#line ⇒ Object
Line object for which output_format is specified.
-
#settings ⇒ Object
output_format settings.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ OutputFormat
constructor
Specifies output format for a line ===Usage Example: output_format = CF::OutputFormat.new(=> [{:name => “First Name”],:station_2 => [=> “Mobile”, :except => true]}) line.output_formats output_format.
Constructor Details
#initialize(options = {}) ⇒ OutputFormat
Specifies output format for a line
Usage Example:
output_format = CF::OutputFormat.new({:station_1 => [{:name => "First Name"}],:station_2 => [{:name => "Mobile", :except => true}]})
line.output_formats output_format
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cf/output_format.rb', line 19 def initialize(={}) if !.blank? @settings = @line = [:line] if [:line].nil? ? nil : [:line] if !@line.nil? .delete(:line) request = { :body => { :api_key => CF.api_key, :output_formats => } } resp = HTTParty.post("#{CF.api_url}#{CF.api_version}/lines/#{CF.account_name}/#{@line.title.downcase}/output_format.json",request) self.errors = resp.parsed_response['error']['message'] if resp.code != 200 self.line.output_formats = self end end end |
Instance Attribute Details
#errors ⇒ Object
Contains error message if any
10 11 12 |
# File 'lib/cf/output_format.rb', line 10 def errors @errors end |
#line ⇒ Object
Line object for which output_format is specified
13 14 15 |
# File 'lib/cf/output_format.rb', line 13 def line @line end |
#settings ⇒ Object
output_format settings
7 8 9 |
# File 'lib/cf/output_format.rb', line 7 def settings @settings end |