Class: TrailAPI::Base
- Inherits:
-
Object
show all
- Extended by:
- ActionController::UrlFor, ActionDispatch::Routing::PolymorphicRoutes
- Includes:
- HTTParty
- Defined in:
- lib/trail_api/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
30
31
32
|
# File 'lib/trail_api/base.rb', line 30
def initialize
end
|
Class Method Details
.api_path_for(args = {}, options = {}) ⇒ Object
.auth(token) ⇒ Object
26
27
28
|
# File 'lib/trail_api/base.rb', line 26
def self.auth( token )
basic_auth token, "X"
end
|
.hashize(response) ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/trail_api/base.rb', line 38
def self.hashize( response )
if response.is_a?(Array)
response.parsed_response.collect do |result|
Hashie::Mash.new( result )
end
else
Hashie::Mash.new response
end
end
|
.url_options(options = {}) ⇒ Object
34
35
36
|
# File 'lib/trail_api/base.rb', line 34
def self.url_options( options = {} )
{ :host => "localhost", :port => 3000 }
end
|