Module: Pivit::Request
- Included in:
- Client
- Defined in:
- lib/pivit/request.rb
Instance Method Summary collapse
-
#build_endpoint ⇒ String
Builds the api endpoint to reach the Pivotal Api the api endpoint to reach the Pivotal Api.
- #delete(path, options = {}) ⇒ Object
- #get(path, options = {}) ⇒ Object
- #post(path, options = {}) ⇒ Object
- #put(path, options = {}) ⇒ Object
Instance Method Details
#build_endpoint ⇒ String
Builds the api endpoint to reach the Pivotal Api the api endpoint to reach the Pivotal Api
26 27 28 29 30 31 |
# File 'lib/pivit/request.rb', line 26 def build_endpoint endpoint = ssl || self.api_token.nil? ? "https://" : "http://" endpoint << "#{self.username}:#{self.password}@" unless self.authenticated? endpoint << "www.pivotaltracker.com/services/v3/" self.api_endpoint = endpoint end |
#delete(path, options = {}) ⇒ Object
16 17 18 |
# File 'lib/pivit/request.rb', line 16 def delete(path, ={}) request(:delete, path, ).body end |
#get(path, options = {}) ⇒ Object
3 4 5 6 |
# File 'lib/pivit/request.rb', line 3 def get(path, = {}) response = request(:get, path, ) response.body end |
#post(path, options = {}) ⇒ Object
8 9 10 |
# File 'lib/pivit/request.rb', line 8 def post(path, = {}) request(:post, path, ).body end |
#put(path, options = {}) ⇒ Object
12 13 14 |
# File 'lib/pivit/request.rb', line 12 def put(path, ={}) request(:put, path, ).body end |