Class: SecQuery::SecURI

Inherits:
Object
  • Object
show all
Defined in:
lib/sec_query/sec_uri.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSecURI

Returns a new instance of SecURI.



59
60
61
62
63
# File 'lib/sec_query/sec_uri.rb', line 59

def initialize
  self.host = 'www.sec.gov'
  self.scheme = 'http'
  self.path = 'cgi-bin'
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/sec_query/sec_uri.rb', line 5

def host
  @host
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/sec_query/sec_uri.rb', line 5

def path
  @path
end

#query_valuesObject

Returns the value of attribute query_values.



5
6
7
# File 'lib/sec_query/sec_uri.rb', line 5

def query_values
  @query_values
end

#schemeObject

Returns the value of attribute scheme.



5
6
7
# File 'lib/sec_query/sec_uri.rb', line 5

def scheme
  @scheme
end

Class Method Details

.browse_edgar_uri(args = nil) ⇒ Object



7
8
9
# File 'lib/sec_query/sec_uri.rb', line 7

def self.browse_edgar_uri(args = nil)
  build_with_path('/browse-edgar', args)
end

.build_with_path(path, args) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/sec_query/sec_uri.rb', line 15

def self.build_with_path(path, args)
  instance = SecURI.new
  instance.path += path
  return instance if args.nil?
  options = send("handle_#{ args.class.to_s.underscore }_args", args)
  instance.query_values = options
  instance
end

.ownership_display_uri(args = nil) ⇒ Object



11
12
13
# File 'lib/sec_query/sec_uri.rb', line 11

def self.ownership_display_uri(args = nil)
  build_with_path('/own-disp', args)
end

Instance Method Details

#[]=(key, value) ⇒ Object



65
66
67
68
# File 'lib/sec_query/sec_uri.rb', line 65

def []=(key, value)
  query_values[key] = value
  self
end

#output_atomObject



70
71
72
73
# File 'lib/sec_query/sec_uri.rb', line 70

def output_atom
  query_values.merge!(output: 'atom')
  self
end

#to_sObject



75
76
77
# File 'lib/sec_query/sec_uri.rb', line 75

def to_s
  uri.to_s
end

#to_strObject



79
80
81
# File 'lib/sec_query/sec_uri.rb', line 79

def to_str
  to_s
end