Included modules
- HTTParty
Attributes
account | [R] | |
httparty_opts | [R] | |
key | [R] | |
response | [R] |
Public class methods
new
(account=nil, key=nil, httparty_opts={})
[show source]
# File lib/stella.rb, line 212 def initialize account=nil, key=nil, httparty_opts={} self.class.base_uri ENV['STELLA_HOST'] || 'https://www.blamestella.com/api/v2' @httparty_opts = httparty_opts @account = account || ENV['STELLA_ACCOUNT'] @key = key || ENV['STELLA_KEY'] unless @account.to_s.empty? || @key.to_s.empty? httparty_opts[:basic_auth] ||= { :username => @account, :password => @key } end end
Public instance methods
get
(path, params=nil)
[show source]
# File lib/stella.rb, line 221 def get path, params=nil opts = httparty_opts opts[:query] = params || {} execute_request :get, path, opts end
post
(path, params=nil)
[show source]
# File lib/stella.rb, line 226 def post path, params=nil opts = httparty_opts opts[:body] = params || {} execute_request :post, path, opts end
site_uri
(path)
[show source]
# File lib/stella.rb, line 231 def site_uri path uri = Addressable::URI.parse self.class.base_uri uri.path = uri_path(path) uri.to_s end