stash_api 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3ec81f8d9a97960441b463f1e963cb0b69cc44b
4
- data.tar.gz: 7134590611aaf4f9538f7b2d836a21802970529f
3
+ metadata.gz: 75eb024c966538c2376b885339d98f08d1123019
4
+ data.tar.gz: 821d2ec4fbf2e5175df9f524ec0ab8afe9834396
5
5
  SHA512:
6
- metadata.gz: 2bf0c8080faf3c4383d825eab07cae2aff25610a0d1218ce6aee436a4d2cb6a9ae80879e87eda2615b614872910432e9c14fed1ae82656c0df00e1d96188cc39
7
- data.tar.gz: 199c5afb721b5f012dbe25e65ce26c4c8103c40da0584542700ceaf0445e6030884f105e627d65c099335da62de1ac574e27981fe11ef265838502eda5e1ac01
6
+ metadata.gz: 237c15f1ca4de6e6e69230c6c86d0dca97f2b945f6cd639fe8f6271d8df931f59f70d6d8c6b98813a1591ec281507517f9e5786e9dc493bb7e4c1686b92ddd57
7
+ data.tar.gz: ff99224c0e9eedb25c4f8bdd07a13efe5df79363eba391a9396322673c5858f9732ad2ae16218d048331ecb4d05dde1a98c946c4a71498125a0825ba12fcc807
@@ -1,4 +1,9 @@
1
1
  language: ruby
2
+
2
3
  rvm:
3
4
  - 2.2.0
5
+
6
+ gemfile:
7
+ - Gemfile
8
+
4
9
  before_install: gem install bundler -v 1.10.5
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # StashAPI
2
2
 
3
+ [![Build Status](https://magnum.travis-ci.com/zach-chai/stash_api.svg?token=A1zsSYqVH6BgLegWZuAj&branch=master)](https://magnum.travis-ci.com/zach-chai/stash_api)
4
+
3
5
  A client for interacting with Atlassian Stash API
4
6
 
5
7
  ## Installation
@@ -6,6 +6,18 @@ module HTTP
6
6
  include HTTParty
7
7
  end
8
8
 
9
+ class Response
10
+
11
+ attr_accessor :parsed_body, :code, :headers, :http_response
12
+
13
+ def initialize(body, code, headers, response)
14
+ self.parsed_body = body
15
+ self.code = code
16
+ self.headers = headers
17
+ self.http_response = response
18
+ end
19
+ end
20
+
9
21
  class Client
10
22
  class << self
11
23
 
@@ -14,11 +26,13 @@ module HTTP
14
26
  end
15
27
 
16
28
  def get(path, options = {})
17
- Basement.get(path, options);
29
+ res = Basement.get(path, options);
30
+ Response.new res.parsed_response, res.code, res.headers, res.response
18
31
  end
19
32
 
20
33
  def post(path, options = {})
21
- Basement.post(path, options);
34
+ res = Basement.post(path, options);
35
+ Response.new res.parsed_response, res.code, res.headers, res.response
22
36
  end
23
37
 
24
38
  def base_uri
@@ -12,35 +12,7 @@ module StashAPI
12
12
  response = HTTP::Client.get resource_path, options
13
13
  reset_resource_chain
14
14
 
15
- if response.code == 200
16
- response.parsed_response
17
- else
18
- response.code
19
- end
20
- end
21
-
22
- def self.fetch_all(query = {})
23
- raise "set a domain first 'StashAPI::Base.domain(<domain>)'" unless StashAPI::Options.option(:domain)
24
-
25
- options = {}
26
- query[:limit] = 1000
27
- query[:start] = 0
28
- options[:query] = query
29
-
30
- results = []
31
-
32
- begin
33
- response = HTTP::Client.get(resource_path, options)
34
-
35
- if response.code == 200
36
- response = response.parsed_response
37
- results.concat response['values']
38
- options[:query][:start] = response['start'] + response['limit']
39
- else
40
- results == response
41
- end
42
- end while !response['isLastPage']
43
- results
15
+ response
44
16
  end
45
17
 
46
18
  def self.create_resource(payload, options = {})
@@ -50,6 +22,7 @@ module StashAPI
50
22
  options[:headers] = {'Content-Type' => 'application/json'}
51
23
 
52
24
  response = HTTP::Client.post resource_path, options
25
+ reset_resource_chain
53
26
 
54
27
  response
55
28
  end
@@ -1,3 +1,3 @@
1
1
  module StashAPI
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stash_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Chai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-14 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty