Module: Psc

Defined in:
lib/psc.rb,
lib/psc/client.rb,
lib/psc/version.rb,
lib/psc/connection.rb,
lib/psc/faraday/psc_token.rb,
lib/psc/faraday/string_is_xml.rb,
lib/psc/faraday/accept_psc_types.rb

Overview

The namespace for psc.rb.

Defined Under Namespace

Modules: Faraday Classes: Client, Connection

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.xml(root_name, root_attributes = {}, &block) ⇒ String

Wraps Builder::XmlMarkup to ease the construction of PSC XML entities. For example:

Psc.xml('study-snapshot', :assigned_identifier => 'YUV 1234') do |snap|
  snap.tag!('long-title', 'Why you validly counting?')
  snap.tag!('planned-calendar') { |pc|
    pc.epoch(:name => 'Run-in') { |e|
      # and so on
    }
  }
  snap.sources { |sources|
    sources.source { |src|
      # and so on
    }
  }
}

Returns:

  • (String)

    the constructed XML

See Also:



30
31
32
33
# File 'lib/psc.rb', line 30

def self.xml(root_name, root_attributes={}, &block)
  root_attributes['xmlns'] = xml_namespace['psc']
  Builder::XmlMarkup.new(:indent => 2).tag!(root_name, root_attributes, &block)
end

.xml_namespaceHash<String, String>

Provides an XML namespace mapping suitable for use with Nokogiri. The prefix psc is mapped to PSC's namespace.

Returns:

  • (Hash<String, String>)

    the mapping



44
45
46
# File 'lib/psc.rb', line 44

def self.xml_namespace
  XML_NAMESPACE
end