Class: Resas::Api::Client::Path
- Inherits:
-
Object
- Object
- Resas::Api::Client::Path
- Defined in:
- lib/resas/api/client/path.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api_version, *namespaces, options) ⇒ Path
constructor
A new instance of Path.
- #to_s ⇒ Object
Constructor Details
#initialize(api_version, *namespaces, options) ⇒ Path
Returns a new instance of Path.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/resas/api/client/path.rb', line 15 def initialize( api_version, *namespaces, ) raise TypeError unless namespaces.instance_of?( Array ) raise TypeError unless .instance_of?( Hash ) @api_version = api_version @namespaces = namespaces.flatten.map( &:to_s ).map { | str | str.split( '/' ).map { | str2 | str2.camelize( :lower ) } }.flatten @options = end |
Class Method Details
.get(api_version, *args) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/resas/api/client/path.rb', line 8 def self.get( api_version, *args ) args = [ args ] args.flatten! = args. new( api_version, *args, ).to_s end |
Instance Method Details
#to_s ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/resas/api/client/path.rb', line 26 def to_s result = '/' + dirs.join( '/' ) _queries = queries if _queries.present? result += "?#{ _queries }" end result end |