atlas-api 0.0.1 → 0.0.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.
- data/Gemfile.lock +9 -5
- data/atlas-api.gemspec +1 -1
- data/lib/atlas-api/client.rb +6 -5
- data/lib/atlas-api/version.rb +1 -1
- data/spec/atlas-api/client_spec.rb +18 -7
- metadata +6 -6
data/Gemfile.lock
CHANGED
@@ -2,20 +2,24 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
atlas-api (0.0.1)
|
5
|
-
faraday (
|
5
|
+
faraday (= 0.6.0)
|
6
6
|
hashie (~> 2.0.5)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.
|
11
|
+
addressable (2.2.8)
|
12
12
|
crack (0.4.1)
|
13
13
|
safe_yaml (~> 0.9.0)
|
14
14
|
diff-lcs (1.2.4)
|
15
|
-
faraday (0.
|
16
|
-
|
15
|
+
faraday (0.6.0)
|
16
|
+
addressable (~> 2.2.4)
|
17
|
+
multipart-post (~> 1.1.0)
|
18
|
+
rack (>= 1.1.0, < 2)
|
19
|
+
rack (>= 1.1.0, < 2)
|
17
20
|
hashie (2.0.5)
|
18
|
-
multipart-post (1.
|
21
|
+
multipart-post (1.1.5)
|
22
|
+
rack (1.5.2)
|
19
23
|
rake (10.1.0)
|
20
24
|
rspec (2.14.1)
|
21
25
|
rspec-core (~> 2.14.0)
|
data/atlas-api.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_dependency "faraday", "
|
20
|
+
gem.add_dependency "faraday", "0.6.0"
|
21
21
|
gem.add_dependency "hashie", "~> 2.0.5"
|
22
22
|
gem.add_development_dependency "rspec"
|
23
23
|
gem.add_development_dependency "webmock"
|
data/lib/atlas-api/client.rb
CHANGED
@@ -15,22 +15,22 @@ module Atlas
|
|
15
15
|
# ------------------------------------------------------------------------
|
16
16
|
|
17
17
|
def builds(options = {})
|
18
|
-
get("
|
18
|
+
get("builds", options)
|
19
19
|
end
|
20
20
|
|
21
21
|
def build(id, options = {})
|
22
|
-
get("
|
22
|
+
get("builds/#{id}", options)
|
23
23
|
end
|
24
24
|
|
25
25
|
def create_build(options)
|
26
|
-
post("
|
26
|
+
post("builds", options)
|
27
27
|
end
|
28
28
|
|
29
29
|
# Build Formats
|
30
30
|
# ------------------------------------------------------------------------
|
31
31
|
|
32
32
|
def update_build_format(uuid, options = {})
|
33
|
-
put("
|
33
|
+
put("build_formats/#{uuid}", options)
|
34
34
|
end
|
35
35
|
|
36
36
|
# HTTP methods
|
@@ -53,7 +53,8 @@ module Atlas
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def agent
|
56
|
-
@agent ||= Faraday.new(@api_endpoint,
|
56
|
+
@agent ||= Faraday.new(url: @api_endpoint, params: { auth_token: @auth_token })
|
57
|
+
@agent
|
57
58
|
end
|
58
59
|
|
59
60
|
private
|
data/lib/atlas-api/version.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Atlas::Api::Client do
|
4
4
|
|
5
5
|
def stub_request_with_token(method, path, body, query = {})
|
6
|
-
stub_request(method, "#{@endpoint}
|
6
|
+
stub_request(method, "#{@endpoint}/#{path}?auth_token=#{@token}").with(:body => query).to_return(:body => body)
|
7
7
|
end
|
8
8
|
|
9
9
|
before(:each) do
|
@@ -24,13 +24,24 @@ describe Atlas::Api::Client do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should use auth_token and api_endpoint in calls and return hashie" do
|
27
|
-
stub = stub_request_with_token(:get, "
|
28
|
-
res = @client.get("
|
27
|
+
stub = stub_request_with_token(:get, "fake", @body.to_json)
|
28
|
+
res = @client.get("fake")
|
29
29
|
stub.should have_been_requested
|
30
30
|
res.should be_instance_of(Hashie::Mash)
|
31
31
|
res.message.should == @body[:message]
|
32
32
|
end
|
33
33
|
|
34
|
+
it "should combine paths from endpoint and path" do
|
35
|
+
@endpoint = "http://www.runemadsen.com/api"
|
36
|
+
client = Atlas::Api::Client.new(
|
37
|
+
auth_token: @token,
|
38
|
+
api_endpoint: @endpoint
|
39
|
+
)
|
40
|
+
stub = stub_request_with_token(:get, "fake", @body.to_json)
|
41
|
+
res = client.get("fake")
|
42
|
+
stub.should have_been_requested
|
43
|
+
end
|
44
|
+
|
34
45
|
end
|
35
46
|
|
36
47
|
describe "Builds" do
|
@@ -42,19 +53,19 @@ describe Atlas::Api::Client do
|
|
42
53
|
:branch => "master",
|
43
54
|
:pingback_url => "http://www.someurl.com"
|
44
55
|
}
|
45
|
-
stub = stub_request_with_token(:post, "
|
56
|
+
stub = stub_request_with_token(:post, "builds", @body.to_json, query)
|
46
57
|
@client.create_build(query)
|
47
58
|
stub.should have_been_requested
|
48
59
|
end
|
49
60
|
|
50
61
|
it "#build" do
|
51
|
-
stub = stub_request_with_token(:get, "
|
62
|
+
stub = stub_request_with_token(:get, "builds/1", @body.to_json)
|
52
63
|
@client.build(1)
|
53
64
|
stub.should have_been_requested
|
54
65
|
end
|
55
66
|
|
56
67
|
it "#builds" do
|
57
|
-
stub = stub_request_with_token(:get, "
|
68
|
+
stub = stub_request_with_token(:get, "builds", @body.to_json)
|
58
69
|
@client.builds
|
59
70
|
stub.should have_been_requested
|
60
71
|
end
|
@@ -73,7 +84,7 @@ describe Atlas::Api::Client do
|
|
73
84
|
:download_url => "http://www.someurl.com",
|
74
85
|
:status => "success"
|
75
86
|
}
|
76
|
-
stub = stub_request_with_token(:put, "
|
87
|
+
stub = stub_request_with_token(:put, "build_formats/#{@uuid}", @body.to_json, query)
|
77
88
|
@client.update_build_format(@uuid, query)
|
78
89
|
stub.should have_been_requested
|
79
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atlas-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.6.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.6.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: hashie
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|