Class: SecEdgar::SecURI
- Inherits:
-
Object
- Object
- SecEdgar::SecURI
- Defined in:
- lib/sec_edgar/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.
67 68 69 70 71 |
# File 'lib/sec_edgar/sec_uri.rb', line 67 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.
5 6 7 |
# File 'lib/sec_edgar/sec_uri.rb', line 5 def host @host end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/sec_edgar/sec_uri.rb', line 5 def path @path end |
#query_values ⇒ Object
Returns the value of attribute query_values.
5 6 7 |
# File 'lib/sec_edgar/sec_uri.rb', line 5 def query_values @query_values end |
#scheme ⇒ Object
Returns the value of attribute scheme.
5 6 7 |
# File 'lib/sec_edgar/sec_uri.rb', line 5 def scheme @scheme end |
Class Method Details
.browse_edgar_uri(args = nil) ⇒ Object
7 8 9 |
# File 'lib/sec_edgar/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
23 24 25 26 27 28 29 30 |
# File 'lib/sec_edgar/sec_uri.rb', line 23 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
11 12 13 14 15 16 17 |
# File 'lib/sec_edgar/sec_uri.rb', line 11 def self.for_date(date) instance = SecURI.new instance.scheme = 'ftp' instance.host = 'ftp.sec.gov' instance.path = "edgar/daily-index/#{ date.to_sec_uri_format }" instance end |
.ownership_display_uri(args = nil) ⇒ Object
19 20 21 |
# File 'lib/sec_edgar/sec_uri.rb', line 19 def self.ownership_display_uri(args = nil) build_with_path('/own-disp', args) end |
Instance Method Details
#[]=(key, value) ⇒ Object
73 74 75 76 |
# File 'lib/sec_edgar/sec_uri.rb', line 73 def []=(key, value) query_values[key] = value self end |
#output_atom ⇒ Object
78 79 80 81 |
# File 'lib/sec_edgar/sec_uri.rb', line 78 def output_atom query_values.merge!(output: 'atom') self end |
#to_s ⇒ Object
83 84 85 |
# File 'lib/sec_edgar/sec_uri.rb', line 83 def to_s uri.to_s end |
#to_str ⇒ Object
87 88 89 |
# File 'lib/sec_edgar/sec_uri.rb', line 87 def to_str to_s end |