Class: SecQuery::SecURI
- Inherits:
-
Object
- Object
- SecQuery::SecURI
- Defined in:
- lib/sec_query/sec_uri.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#path ⇒ Object
Returns the value of attribute path.
-
#query_values ⇒ Object
Returns the value of attribute query_values.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
Class Method Summary collapse
- .browse_edgar_uri(args = nil) ⇒ Object
- .build_with_path(path, args) ⇒ Object
- .for_date(date) ⇒ Object
- .ownership_display_uri(args = nil) ⇒ Object
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
-
#initialize ⇒ SecURI
constructor
A new instance of SecURI.
- #output_atom ⇒ Object
- #to_s ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize ⇒ SecURI
Returns a new instance of SecURI.
82 83 84 85 86 |
# File 'lib/sec_query/sec_uri.rb', line 82 def initialize self.host = 'www.sec.gov' self.scheme = 'https' self.path = 'cgi-bin' end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
20 21 22 |
# File 'lib/sec_query/sec_uri.rb', line 20 def host @host end |
#path ⇒ Object
Returns the value of attribute path.
20 21 22 |
# File 'lib/sec_query/sec_uri.rb', line 20 def path @path end |
#query_values ⇒ Object
Returns the value of attribute query_values.
20 21 22 |
# File 'lib/sec_query/sec_uri.rb', line 20 def query_values @query_values end |
#scheme ⇒ Object
Returns the value of attribute scheme.
20 21 22 |
# File 'lib/sec_query/sec_uri.rb', line 20 def scheme @scheme end |
Class Method Details
.browse_edgar_uri(args = nil) ⇒ Object
22 23 24 |
# File 'lib/sec_query/sec_uri.rb', line 22 def self.browse_edgar_uri(args = nil) build_with_path('/browse-edgar', args) end |
.build_with_path(path, args) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/sec_query/sec_uri.rb', line 38 def self.build_with_path(path, args) instance = SecURI.new instance.path += path return instance if args.nil? = send("handle_#{ args.class.to_s.underscore }_args", args) instance.query_values = instance end |
.for_date(date) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/sec_query/sec_uri.rb', line 26 def self.for_date(date) instance = SecURI.new instance.host = 'www.sec.gov' instance.scheme = 'https' instance.path = "Archives/edgar/daily-index/#{ date.to_sec_uri_format }" instance end |
.ownership_display_uri(args = nil) ⇒ Object
34 35 36 |
# File 'lib/sec_query/sec_uri.rb', line 34 def self.ownership_display_uri(args = nil) build_with_path('/own-disp', args) end |
Instance Method Details
#[]=(key, value) ⇒ Object
88 89 90 91 |
# File 'lib/sec_query/sec_uri.rb', line 88 def []=(key, value) query_values[key] = value self end |
#output_atom ⇒ Object
93 94 95 96 |
# File 'lib/sec_query/sec_uri.rb', line 93 def output_atom query_values.merge!(output: 'atom') self end |
#to_s ⇒ Object
98 99 100 |
# File 'lib/sec_query/sec_uri.rb', line 98 def to_s uri.to_s end |
#to_str ⇒ Object
102 103 104 |
# File 'lib/sec_query/sec_uri.rb', line 102 def to_str to_s end |