class Gini::Api::Document::Layout

Contains document layout in XML & JSON

Public Class Methods

new(api, location) click to toggle source

Instantiate a new Gini::Api::Layout object from layout url

@param [Gini::Api::Client] api Gini::Api::Client object @param [String] location Document URL

# File lib/gini-api/document/layout.rb, line 12
def initialize(api, location)
  @api      = api
  @location = location
end

Public Instance Methods

to_json() click to toggle source

Return layout as JSON string

@return [String] Returns the layout as JSON string

# File lib/gini-api/document/layout.rb, line 27
def to_json
  @json ||= get_json
end
to_xml() click to toggle source

Return layout as XML string

@return [String] Returns the layout as XML string

# File lib/gini-api/document/layout.rb, line 20
def to_xml
  @xml ||= get_xml
end

Private Instance Methods

get_json() click to toggle source

Get value of extraction. Convinience method

@return [String] Returns layout JSON

# File lib/gini-api/document/layout.rb, line 44
def get_json
  response = @api.request(:get, @location)
  response.body if response.status == 200
end
get_xml() click to toggle source

Get value of layout in XML

@return [String] Returns layout XML

# File lib/gini-api/document/layout.rb, line 36
def get_xml
  response = @api.request(:get, @location, type: 'xml')
  response.body if response.status == 200
end