phone_gap-build 0.3.0 → 0.4.0
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 +4 -4
- data/.ruby-version +1 -0
- data/README.md +7 -8
- data/lib/phone_gap/build/api_request.rb +60 -0
- data/lib/phone_gap/build/app.rb +4 -0
- data/lib/phone_gap/build/base.rb +13 -0
- data/lib/phone_gap/build/credentials.rb +11 -2
- data/lib/phone_gap/build/error.rb +11 -0
- data/lib/phone_gap/build/rest_resource.rb +6 -14
- data/lib/phone_gap/build/version.rb +1 -1
- data/lib/phone_gap/build.rb +17 -3
- data/spec/phone_gap/build/api_request_spec.rb +112 -0
- data/spec/phone_gap/build/app_spec.rb +23 -2
- data/spec/phone_gap/build/credentials_spec.rb +32 -0
- data/spec/phone_gap/build/rest_resource_spec.rb +18 -14
- data/spec/spec_helper.rb +1 -1
- data/spec/support/fixtures.rb +2 -2
- metadata +24 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eecaeb180ecb3f2c04f9dce4badb7857f7fe728d
|
4
|
+
data.tar.gz: d9d37fdebe1f87bb45ad18c4fd2a1cccec011b66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b794e509e9ef17ac0a028e21506fb4c7097c4a43fadc8b65472fbd5443ed9b87ec8ab0e9514e5292767c828603e71f89870061de5d4421298a630cdf8bbf883
|
7
|
+
data.tar.gz: 9cbf50b934de26a896352d6a0b479f60872ae942ff2cb9dd374c86f8530555b8d2ddcb5f5a392e37cc178cc988ef6fdd34f7b9a00d84023555deb473a7ff375d
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p451
|
data/README.md
CHANGED
@@ -30,24 +30,23 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
apps = PhoneGap::Build.apps
|
32
32
|
|
33
|
-
#
|
34
|
-
|
33
|
+
# update an existing app
|
35
34
|
app = apps.first
|
36
|
-
|
37
35
|
app.description = 'Fancy Pants App'
|
38
|
-
|
39
|
-
app.save (#save will update an existing app)
|
36
|
+
app.save
|
40
37
|
|
41
38
|
# create a new app
|
42
|
-
|
43
39
|
app = PhoneGap::Build::App.new
|
44
40
|
|
45
41
|
# add any required values (see http://docs.build.phonegap.com/en_US/3.3.0/developer_api_api.md.html#PhoneGap%20Build%20Developer%20API)
|
42
|
+
app.title = 'Batman'
|
43
|
+
app.create_method = 'file'
|
44
|
+
app.file = File.new('./batman-files/gotham.city')
|
46
45
|
|
47
|
-
|
46
|
+
# save/create the app
|
47
|
+
app.save
|
48
48
|
|
49
49
|
# delete it!
|
50
|
-
|
51
50
|
app.destroy
|
52
51
|
|
53
52
|
## Contributing
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module PhoneGap
|
2
|
+
module Build
|
3
|
+
class ApiRequest
|
4
|
+
|
5
|
+
include HTTMultiParty
|
6
|
+
base_uri 'https://build.phonegap.com/api/v1'
|
7
|
+
|
8
|
+
def get(path)
|
9
|
+
if credentials?
|
10
|
+
self.class.get("#{path}?auth_token=#{token}")
|
11
|
+
else
|
12
|
+
credentials_not_found
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def post(path, params = {})
|
17
|
+
if credentials?
|
18
|
+
self.class.post("#{path}?auth_token=#{token}", query: params[:query])
|
19
|
+
else
|
20
|
+
credentials_not_found
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def put(path, params = {})
|
25
|
+
if credentials?
|
26
|
+
self.class.put("#{path}?auth_token=#{token}", query: params[:query])
|
27
|
+
else
|
28
|
+
credentials_not_found
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def delete(path, params = {})
|
33
|
+
if credentials?
|
34
|
+
self.class.delete("#{path}?auth_token=#{token}")
|
35
|
+
else
|
36
|
+
credentials_not_found
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def credentials?
|
43
|
+
if PhoneGap::Build::Credentials.instance.token
|
44
|
+
true
|
45
|
+
else
|
46
|
+
Credentials.instance.load
|
47
|
+
PhoneGap::Build::Credentials.instance.token
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def credentials_not_found
|
52
|
+
Error.new(message: 'Api credentials not found. Set them or add them to config/phonegap.yml')
|
53
|
+
end
|
54
|
+
|
55
|
+
def token
|
56
|
+
PhoneGap::Build::Credentials.instance.token
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/phone_gap/build/app.rb
CHANGED
@@ -6,7 +6,7 @@ module PhoneGap
|
|
6
6
|
|
7
7
|
include Singleton
|
8
8
|
|
9
|
-
attr_reader :username, :password, :token
|
9
|
+
attr_reader :username, :password, :token, :config
|
10
10
|
attr_writer :token
|
11
11
|
|
12
12
|
def set(credentials)
|
@@ -15,6 +15,15 @@ module PhoneGap
|
|
15
15
|
@token = credentials[:token]
|
16
16
|
self
|
17
17
|
end
|
18
|
+
|
19
|
+
def load
|
20
|
+
config_file = File.expand_path('../../../../config/phonegap.yml', __FILE__)
|
21
|
+
if File.exists? config_file
|
22
|
+
@config = YAML::load_file(config_file)
|
23
|
+
@token = @config['token']
|
24
|
+
end
|
25
|
+
self
|
26
|
+
end
|
18
27
|
end
|
19
28
|
end
|
20
|
-
end
|
29
|
+
end
|
@@ -1,22 +1,14 @@
|
|
1
1
|
require 'phone_gap/build/creatable'
|
2
|
-
require 'httmultiparty'
|
3
2
|
|
4
3
|
module PhoneGap
|
5
4
|
module Build
|
6
|
-
class RestResource
|
5
|
+
class RestResource < Base
|
7
6
|
|
8
7
|
include PhoneGap::Build::Creatable
|
9
|
-
|
10
|
-
base_uri 'https://build.phonegap.com/api/v1'
|
11
|
-
|
12
|
-
def initialize(attributes = {})
|
13
|
-
attributes.each do |key, value|
|
14
|
-
instance_variable_set("@#{key}", value)
|
15
|
-
end
|
16
|
-
end
|
8
|
+
attr_reader :id
|
17
9
|
|
18
10
|
def create
|
19
|
-
response =
|
11
|
+
response = ApiRequest.new.post(path, post_options)
|
20
12
|
if response.success?
|
21
13
|
populate_from_json(JSON.parse(response.body))
|
22
14
|
end
|
@@ -24,7 +16,7 @@ module PhoneGap
|
|
24
16
|
end
|
25
17
|
|
26
18
|
def update
|
27
|
-
|
19
|
+
ApiRequest.new.put(path, query: {data: as_json(only: updatable_attributes)})
|
28
20
|
end
|
29
21
|
|
30
22
|
def save
|
@@ -32,7 +24,7 @@ module PhoneGap
|
|
32
24
|
end
|
33
25
|
|
34
26
|
def destroy
|
35
|
-
|
27
|
+
ApiRequest.new.delete(path)
|
36
28
|
end
|
37
29
|
|
38
30
|
def as_json(params = {})
|
@@ -54,7 +46,7 @@ module PhoneGap
|
|
54
46
|
end
|
55
47
|
|
56
48
|
def path
|
57
|
-
@id ? "#{self.class.const_get('PATH')}/#{@id}
|
49
|
+
@id ? "#{self.class.const_get('PATH')}/#{@id}" : "#{self.class.const_get('PATH')}"
|
58
50
|
end
|
59
51
|
|
60
52
|
def token
|
data/lib/phone_gap/build.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
require 'phone_gap/build/version'
|
2
|
+
require 'phone_gap/build/base'
|
2
3
|
require 'phone_gap/build/credentials'
|
3
4
|
require 'phone_gap/build/app_factory'
|
4
5
|
require 'phone_gap/build/app'
|
6
|
+
require 'phone_gap/build/api_request'
|
5
7
|
require 'phone_gap/build/rest_resource'
|
6
8
|
require 'phone_gap/build/creatable'
|
9
|
+
require 'phone_gap/build/error'
|
7
10
|
|
8
11
|
require 'httparty'
|
9
12
|
|
@@ -15,10 +18,21 @@ module PhoneGap
|
|
15
18
|
end
|
16
19
|
|
17
20
|
def self.apps
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
+
if credentials?
|
22
|
+
http_response = HTTParty.get("https://build.phonegap.com/api/v1/apps?auth_token=#{@credentials.token}")
|
23
|
+
parsed_response = JSON.parse(http_response.body)
|
24
|
+
AppFactory.create_many(parsed_response)
|
25
|
+
else
|
26
|
+
Error.new(message: 'Api credentials not found. Set them or add thmem to config/phonegap.yml')
|
27
|
+
end
|
21
28
|
end
|
22
29
|
|
30
|
+
def self.credentials?
|
31
|
+
if @credentials && @credentials.token
|
32
|
+
true
|
33
|
+
else
|
34
|
+
Credentials.instance.load
|
35
|
+
end
|
36
|
+
end
|
23
37
|
end
|
24
38
|
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PhoneGap::Build::ApiRequest do
|
4
|
+
|
5
|
+
describe 'checking that configuration exists before sending a request' do
|
6
|
+
|
7
|
+
%w(get post put delete).each do |request_action|
|
8
|
+
|
9
|
+
describe "##{request_action}" do
|
10
|
+
|
11
|
+
context 'without configuration set' do
|
12
|
+
|
13
|
+
let(:credentials) { double( 'Credentials', token: false) }
|
14
|
+
|
15
|
+
before do
|
16
|
+
PhoneGap::Build::Credentials.stub(:instance).and_return credentials
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'looks for credentials configuration' do
|
20
|
+
expect(credentials).to receive(:load).and_return credentials
|
21
|
+
subject.send request_action, 'path'
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when credentials configuration exists' do
|
25
|
+
|
26
|
+
before do
|
27
|
+
credentials.stub(:load).and_return credentials
|
28
|
+
credentials.stub(:token).and_return 'BATMAN TOKEN'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'makes the api call' do
|
32
|
+
expect(subject.class).to receive(request_action.to_sym)
|
33
|
+
subject.send request_action, 'path'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when credentials configuration does not exist' do
|
38
|
+
|
39
|
+
before do
|
40
|
+
credentials.stub(:load).and_return false
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'returns an error' do
|
44
|
+
expect(subject.send(request_action, 'path').message).to eq 'Api credentials not found. Set them or add them to config/phonegap.yml'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'when credentials exist' do
|
53
|
+
|
54
|
+
let(:token) { 'BATMAN' }
|
55
|
+
|
56
|
+
before do
|
57
|
+
PhoneGap::Build::Credentials.instance.set(token: token)
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#get' do
|
61
|
+
|
62
|
+
it 'sends a GET request to the given path with the auth_token included' do
|
63
|
+
expect(subject.class).to receive(:get).with('some fancy path?auth_token=BATMAN')
|
64
|
+
subject.get('some fancy path')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe '#post' do
|
69
|
+
|
70
|
+
it 'sends a POST request to the given path with the auth_token included' do
|
71
|
+
expect(subject.class).to receive(:post).with('some fancy path?auth_token=BATMAN', anything)
|
72
|
+
subject.post('some fancy path')
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'when query params are available' do
|
76
|
+
|
77
|
+
let(:query_params) { { data: {id: 1, title: 'seb'}} }
|
78
|
+
|
79
|
+
it 'sends them through with the request' do
|
80
|
+
expect(subject.class).to receive(:post).with(anything, query: query_params)
|
81
|
+
subject.post('some fancy path', query: query_params)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe '#put' do
|
87
|
+
|
88
|
+
it 'send a PUT request to the given path with the auth_token included' do
|
89
|
+
expect(subject.class).to receive(:put).with('some fancy path?auth_token=BATMAN', anything)
|
90
|
+
subject.put('some fancy path')
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'when query params are available' do
|
94
|
+
|
95
|
+
let(:query_params) { { data: {id: 1, title: 'seb'}} }
|
96
|
+
|
97
|
+
it 'sends them through with the request' do
|
98
|
+
expect(subject.class).to receive(:put).with(anything, query: query_params)
|
99
|
+
subject.put('some faNCY PATH', query: query_params)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe '#delete' do
|
105
|
+
|
106
|
+
it 'send a DELETE request to the given path with the auth_token included' do
|
107
|
+
expect(subject.class).to receive(:delete).with('some fancy path?auth_token=BATMAN')
|
108
|
+
subject.delete('some fancy path')
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -31,6 +31,7 @@ describe PhoneGap::Build::App do
|
|
31
31
|
describe '#create' do
|
32
32
|
|
33
33
|
let(:response) { double('response', :success? => false) }
|
34
|
+
let(:api_request) { double('PhoneGap::Build::ApiRequest') }
|
34
35
|
|
35
36
|
context 'when there are populated and non-populated creatable variables' do
|
36
37
|
|
@@ -38,11 +39,12 @@ describe PhoneGap::Build::App do
|
|
38
39
|
subject.title = 'title'
|
39
40
|
subject.create_method = 'create method'
|
40
41
|
subject.package = nil
|
42
|
+
PhoneGap::Build::ApiRequest.stub(:new).and_return api_request
|
41
43
|
end
|
42
44
|
|
43
45
|
it 'sends query data for all creatable attributes that do not have a value of nil' do
|
44
46
|
expected_options = { query: {data: { title: 'title', create_method: 'create method'}}}
|
45
|
-
expect(
|
47
|
+
expect(api_request).to receive(:post).with(anything, expected_options).and_return response
|
46
48
|
subject.create
|
47
49
|
end
|
48
50
|
|
@@ -57,10 +59,29 @@ describe PhoneGap::Build::App do
|
|
57
59
|
it 'sends the file through as part of the query' do
|
58
60
|
expected_options =
|
59
61
|
{ query: { file: file, data: {title: 'title', create_method: 'create method'}}, detect_mime_type: true}
|
60
|
-
expect(
|
62
|
+
expect(api_request).to receive(:post).with(anything, expected_options).and_return response
|
61
63
|
subject.create
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|
65
67
|
end
|
68
|
+
|
69
|
+
describe '#build' do
|
70
|
+
|
71
|
+
context 'when the app has an id' do
|
72
|
+
|
73
|
+
let(:id) { 1 }
|
74
|
+
let(:api_request) { double('PhoneGap::Build::ApiRequest') }
|
75
|
+
|
76
|
+
before do
|
77
|
+
subject.instance_variable_set('@id', id)
|
78
|
+
PhoneGap::Build::ApiRequest.stub(:new).and_return api_request
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'sends a POST request to build the app' do
|
82
|
+
expect(api_request).to receive(:post).with("/apps/#{subject.id}/build")
|
83
|
+
subject.build
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
66
87
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PhoneGap::Build::Credentials do
|
4
|
+
|
5
|
+
subject { PhoneGap::Build::Credentials .instance }
|
6
|
+
|
7
|
+
describe '#load' do
|
8
|
+
|
9
|
+
let(:config_file) { File.expand_path('config/phonegap.yml', ROOT_DIR) }
|
10
|
+
|
11
|
+
before do
|
12
|
+
File.stub(:exists?).with(config_file).and_return true
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'tries to load a phonegap config file' do
|
16
|
+
expect(YAML).to receive(:load_file).with(config_file).and_return({})
|
17
|
+
subject.load
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'if a config file exists' do
|
21
|
+
|
22
|
+
before do
|
23
|
+
YAML.stub(:load_file).and_return({'token' => 'BATMAN'})
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'populates the credentials using values from the config file' do
|
27
|
+
subject.load
|
28
|
+
expect(subject.token).to eq 'BATMAN'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -3,6 +3,11 @@ require 'spec_helper'
|
|
3
3
|
describe PhoneGap::Build::RestResource do
|
4
4
|
|
5
5
|
let(:base_uri) { 'https://build.phonegap.com/api/v1/' }
|
6
|
+
let(:api_request) { double('ApiRequest') }
|
7
|
+
|
8
|
+
before do
|
9
|
+
PhoneGap::Build::ApiRequest.stub(:new).and_return api_request
|
10
|
+
end
|
6
11
|
|
7
12
|
context 'when an authentication token is present' do
|
8
13
|
|
@@ -29,16 +34,16 @@ describe PhoneGap::Build::RestResource do
|
|
29
34
|
let(:response) { double('response', success?: false) }
|
30
35
|
|
31
36
|
before do
|
32
|
-
|
37
|
+
# api_request.stub(:post).with('users', query: {data: subject.as_json}).and_return response
|
33
38
|
end
|
34
39
|
|
35
40
|
it 'sends POST request' do
|
36
|
-
expect(
|
41
|
+
expect(api_request).to receive(:post).and_return response
|
37
42
|
subject.create
|
38
43
|
end
|
39
44
|
|
40
45
|
it 'uses the resource base as the path and includes the auth token in the request' do
|
41
|
-
expect(
|
46
|
+
expect(api_request).to receive(:post).with("users", anything).and_return response
|
42
47
|
subject.create
|
43
48
|
end
|
44
49
|
|
@@ -51,7 +56,7 @@ describe PhoneGap::Build::RestResource do
|
|
51
56
|
end
|
52
57
|
|
53
58
|
it 'posts using options from the child class' do
|
54
|
-
expect(
|
59
|
+
expect(api_request).to receive(:post).with(anything, 'wonder woman').and_return response
|
55
60
|
subject.create
|
56
61
|
end
|
57
62
|
end
|
@@ -59,7 +64,7 @@ describe PhoneGap::Build::RestResource do
|
|
59
64
|
context 'child class does not have #post_options' do
|
60
65
|
|
61
66
|
it 'sends a body containing all the json representation of the object' do
|
62
|
-
expect(
|
67
|
+
expect(api_request).to receive(:post).with(anything, query: {data: subject.as_json}).and_return response
|
63
68
|
subject.create
|
64
69
|
end
|
65
70
|
end
|
@@ -69,7 +74,7 @@ describe PhoneGap::Build::RestResource do
|
|
69
74
|
let(:success_response) { double('response', success?: true, body: '{"title" : "Batman", "rating" : 5}') }
|
70
75
|
|
71
76
|
before do
|
72
|
-
|
77
|
+
api_request.stub(:post).with('users', query: {data: {}}).and_return success_response
|
73
78
|
end
|
74
79
|
|
75
80
|
it 'updates the object with any response attributes' do
|
@@ -92,17 +97,17 @@ describe PhoneGap::Build::RestResource do
|
|
92
97
|
end
|
93
98
|
|
94
99
|
it 'sends PUT request' do
|
95
|
-
expect(
|
100
|
+
expect(api_request).to receive(:put)
|
96
101
|
subject.update
|
97
102
|
end
|
98
103
|
|
99
104
|
it 'uses the resource base as the path and includes the auth token in the request' do
|
100
|
-
expect(
|
105
|
+
expect(api_request).to receive(:put).with("users/#{id}", anything)
|
101
106
|
subject.update
|
102
107
|
end
|
103
108
|
|
104
109
|
it 'send a body containing all the json representation of the object' do
|
105
|
-
expect(
|
110
|
+
expect(api_request).to receive(:put).with(anything, query: {data: {}})
|
106
111
|
subject.update
|
107
112
|
end
|
108
113
|
|
@@ -123,7 +128,7 @@ describe PhoneGap::Build::RestResource do
|
|
123
128
|
end
|
124
129
|
|
125
130
|
it 'attempts to update an existing item' do
|
126
|
-
expect(
|
131
|
+
expect(api_request).to receive(:put)
|
127
132
|
subject.save
|
128
133
|
end
|
129
134
|
end
|
@@ -134,11 +139,10 @@ describe PhoneGap::Build::RestResource do
|
|
134
139
|
|
135
140
|
before do
|
136
141
|
subject.id = nil
|
137
|
-
subject.class.stub(:post).and_return http_response
|
138
142
|
end
|
139
143
|
|
140
144
|
it 'attempts to create a new item' do
|
141
|
-
expect(
|
145
|
+
expect(api_request).to receive(:post).and_return http_response
|
142
146
|
subject.save
|
143
147
|
end
|
144
148
|
end
|
@@ -155,12 +159,12 @@ describe PhoneGap::Build::RestResource do
|
|
155
159
|
end
|
156
160
|
|
157
161
|
it 'sends DELETE request' do
|
158
|
-
expect(
|
162
|
+
expect(api_request).to receive(:delete)
|
159
163
|
subject.destroy
|
160
164
|
end
|
161
165
|
|
162
166
|
it 'includes the auth token in the request' do
|
163
|
-
expect(
|
167
|
+
expect(api_request).to receive(:delete).with("users/#{id}")
|
164
168
|
subject.destroy
|
165
169
|
end
|
166
170
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rspec'
|
2
2
|
require_relative '../lib/phone_gap/build'
|
3
3
|
|
4
|
-
ROOT_DIR = Pathname.new(File.expand_path('
|
4
|
+
ROOT_DIR = Pathname.new(File.expand_path('../..', __FILE__))
|
5
5
|
|
6
6
|
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
|
7
7
|
|
data/spec/support/fixtures.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'json'
|
2
2
|
|
3
3
|
def response_body_for(request)
|
4
|
-
fixture_file = File.open(ROOT_DIR + "fixtures/api_responses/#{request}.json")
|
4
|
+
fixture_file = File.open(ROOT_DIR + "spec/fixtures/api_responses/#{request}.json")
|
5
5
|
File.read(fixture_file)
|
6
6
|
end
|
7
7
|
|
8
8
|
def fixture_file(filename)
|
9
|
-
File.new(ROOT_DIR + "fixtures/#{filename}")
|
9
|
+
File.new(ROOT_DIR + "spec/fixtures/#{filename}")
|
10
10
|
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phone_gap-build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seb Glazebrook
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httmultiparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.14.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.14.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: debugger
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: ''
|
@@ -87,23 +87,29 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
-
|
90
|
+
- .gitignore
|
91
|
+
- .ruby-version
|
91
92
|
- Gemfile
|
92
93
|
- LICENSE.txt
|
93
94
|
- README.md
|
94
95
|
- Rakefile
|
95
96
|
- lib/phone_gap/build.rb
|
97
|
+
- lib/phone_gap/build/api_request.rb
|
96
98
|
- lib/phone_gap/build/app.rb
|
97
99
|
- lib/phone_gap/build/app_factory.rb
|
100
|
+
- lib/phone_gap/build/base.rb
|
98
101
|
- lib/phone_gap/build/creatable.rb
|
99
102
|
- lib/phone_gap/build/credentials.rb
|
103
|
+
- lib/phone_gap/build/error.rb
|
100
104
|
- lib/phone_gap/build/rest_resource.rb
|
101
105
|
- lib/phone_gap/build/version.rb
|
102
106
|
- phone_gap-build.gemspec
|
103
107
|
- spec/fixtures/api_responses/get-apps.json
|
104
108
|
- spec/fixtures/api_responses/rest-resource-create.json
|
105
109
|
- spec/fixtures/index.html
|
110
|
+
- spec/phone_gap/build/api_request_spec.rb
|
106
111
|
- spec/phone_gap/build/app_spec.rb
|
112
|
+
- spec/phone_gap/build/credentials_spec.rb
|
107
113
|
- spec/phone_gap/build/rest_resource_spec.rb
|
108
114
|
- spec/phone_gap/build_spec.rb
|
109
115
|
- spec/spec_helper.rb
|
@@ -118,17 +124,17 @@ require_paths:
|
|
118
124
|
- lib
|
119
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
126
|
requirements:
|
121
|
-
- -
|
127
|
+
- - '>='
|
122
128
|
- !ruby/object:Gem::Version
|
123
129
|
version: '0'
|
124
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
131
|
requirements:
|
126
|
-
- -
|
132
|
+
- - '>='
|
127
133
|
- !ruby/object:Gem::Version
|
128
134
|
version: '0'
|
129
135
|
requirements: []
|
130
136
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.0.14
|
132
138
|
signing_key:
|
133
139
|
specification_version: 4
|
134
140
|
summary: PhoneGap Build Api gem
|
@@ -136,7 +142,9 @@ test_files:
|
|
136
142
|
- spec/fixtures/api_responses/get-apps.json
|
137
143
|
- spec/fixtures/api_responses/rest-resource-create.json
|
138
144
|
- spec/fixtures/index.html
|
145
|
+
- spec/phone_gap/build/api_request_spec.rb
|
139
146
|
- spec/phone_gap/build/app_spec.rb
|
147
|
+
- spec/phone_gap/build/credentials_spec.rb
|
140
148
|
- spec/phone_gap/build/rest_resource_spec.rb
|
141
149
|
- spec/phone_gap/build_spec.rb
|
142
150
|
- spec/spec_helper.rb
|