test_flight_client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +36 -0
- data/Rakefile +2 -0
- data/lib/test_flight_client/api_request.rb +44 -0
- data/lib/test_flight_client/version.rb +3 -0
- data/lib/test_flight_client.rb +10 -0
- data/spec/lib/test_flight_client/api_request_spec.rb +89 -0
- data/spec/lib/test_flight_client_spec.rb +28 -0
- data/spec/spec_helper.rb +11 -0
- data/test_flight_client.gemspec +27 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b16d2a0329290ce154594f7fbd712ac9ce0a3059
|
4
|
+
data.tar.gz: 6ed91cf82179b4a0330ea3e699673f2c1d0d4e2c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 80513d9275a241bc22bfaa018274936ab88f87deebbdff4ed83d77c1c08695ec2d2e31a6c3396c8248011bb5ac9c6e534e29fed9736b978674daf9f3f35b7017
|
7
|
+
data.tar.gz: fbf0481a618a0ae2eb21f8aa5ffd92c20c9c379d766875da3bba6e3117eb504e91538eac91c8b02e75e2811454455db76c6f0dc987106b109a579375bbe3bb14
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.idea
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Seb Glazebrook
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# TestFlightClient
|
2
|
+
|
3
|
+
Super simple ruby client for TestFlightApp's super simple developer API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'test_flight_client'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install test_flight_client
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
require 'test_flight_client'
|
22
|
+
|
23
|
+
TestFlightClient.build(
|
24
|
+
api_token: 'your api token',
|
25
|
+
team_token: 'your team token',
|
26
|
+
file: 'file path or file object',
|
27
|
+
notes: 'whatever notes you want to add'
|
28
|
+
)
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it ( https://github.com/[my-github-username]/test_flight_client/fork )
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'httmultiparty'
|
2
|
+
|
3
|
+
module TestFlightClient
|
4
|
+
class ApiRequest
|
5
|
+
|
6
|
+
include HTTMultiParty
|
7
|
+
base_uri 'http://testflightapp.com/api'
|
8
|
+
|
9
|
+
def post(path, params = {})
|
10
|
+
self.class.post("#{path}.json", query: formulate_query_params(params))
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def formulate_query_params params
|
16
|
+
params.inject({}) do |memo, param|
|
17
|
+
if file_based_params.include? param[0].to_sym
|
18
|
+
memo[param[0]] = resolve_file(param[1])
|
19
|
+
else
|
20
|
+
memo[param[0]] = param[1]
|
21
|
+
end
|
22
|
+
memo
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def file_based_params
|
27
|
+
%i(file dsym)
|
28
|
+
end
|
29
|
+
|
30
|
+
def resolve_file(param)
|
31
|
+
if param.class == File
|
32
|
+
param
|
33
|
+
else
|
34
|
+
begin
|
35
|
+
File.new(param, 'r')
|
36
|
+
rescue Exception => e
|
37
|
+
raise IrresolvableFileParameter.new("Could not create a file from parameter #{param}")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class IrresolvableFileParameter < Exception ; end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TestFlightClient::ApiRequest do
|
4
|
+
|
5
|
+
describe '#post' do
|
6
|
+
|
7
|
+
%w(api_token team_token notes
|
8
|
+
distribution_lists notify replace).each do |api_param|
|
9
|
+
|
10
|
+
context "when given a '#{api_param}' parameter" do
|
11
|
+
|
12
|
+
let(:params) do
|
13
|
+
{api_param => 'some param value' }
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'gets posted with the request' do
|
17
|
+
expect(subject.class).to receive(:post).with(anything, query: params)
|
18
|
+
subject.post('some path',params)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when given file based parameters' do
|
24
|
+
|
25
|
+
|
26
|
+
let(:file) { double('file') }
|
27
|
+
let(:dsym) { double('dsym') }
|
28
|
+
let(:params) do
|
29
|
+
{ file: file, dsym: dsym }
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'that\'s values are not files' do
|
33
|
+
|
34
|
+
before do
|
35
|
+
file.stub(:class).and_return String
|
36
|
+
dsym.stub(:class).and_return String
|
37
|
+
subject.class.stub(:post)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'attempts to resolve and read a file' do
|
41
|
+
expect(File).to receive(:new).with(file, 'r')
|
42
|
+
expect(File).to receive(:new).with(dsym, 'r')
|
43
|
+
subject.post('path', params)
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when a file can be resolved' do
|
47
|
+
|
48
|
+
let(:file_double) { double('file double') }
|
49
|
+
let(:dsym_double) { double('dsym double') }
|
50
|
+
|
51
|
+
before do
|
52
|
+
File.stub(:new).with(file, 'r').and_return file_double
|
53
|
+
File.stub(:new).with(dsym, 'r').and_return dsym_double
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'passes through the file to the request' do
|
57
|
+
expect(subject.class).to receive(:post).with(anything, {query: {file: file_double, dsym: dsym_double}})
|
58
|
+
subject.post('path', params)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'when a file can not be resolved' do
|
63
|
+
|
64
|
+
before do
|
65
|
+
File.stub(:new).with(file, 'r').and_raise Exception
|
66
|
+
File.stub(:new).with(dsym, 'r').and_raise Exception
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'returns an error' do
|
70
|
+
expect{subject.post('path', params)}.to raise_error TestFlightClient::ApiRequest::IrresolvableFileParameter
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'that\'s values are files' do
|
76
|
+
|
77
|
+
before do
|
78
|
+
file.stub(:class).and_return File
|
79
|
+
dsym.stub(:class).and_return File
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'passes through the parameters untouched' do
|
83
|
+
expect(subject.class).to receive(:post).with(anything, query: params)
|
84
|
+
subject.post('path', params)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TestFlightClient do
|
4
|
+
|
5
|
+
describe '#build' do
|
6
|
+
|
7
|
+
let(:api_request) { double('api request') }
|
8
|
+
|
9
|
+
before do
|
10
|
+
TestFlightClient::ApiRequest.stub(:new).and_return api_request
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'posts an API request to the "builds" path' do
|
14
|
+
expect(api_request).to receive(:post).with '/builds', anything
|
15
|
+
subject.build
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when given parameters' do
|
19
|
+
|
20
|
+
let(:params) { double('params') }
|
21
|
+
|
22
|
+
it 'posts an API request passing through given parameters' do
|
23
|
+
expect(api_request).to receive(:post).with anything, params
|
24
|
+
subject.build params
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require_relative '../lib/test_flight_client'
|
3
|
+
|
4
|
+
ROOT_DIR = Pathname.new(File.expand_path('../..', __FILE__))
|
5
|
+
|
6
|
+
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.color_enabled = true
|
10
|
+
config.formatter = 'documentation'
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'test_flight_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "test_flight_client"
|
8
|
+
spec.version = TestFlightClient::VERSION
|
9
|
+
spec.authors = ["Seb Glazebrook"]
|
10
|
+
spec.email = ["me@sebglazebrook.com"]
|
11
|
+
spec.summary = %q{Ruby client for TestFlightApp developer API.}
|
12
|
+
spec.description = %q{Super simple ruby client for TestFlightApp's super simple developer API.}
|
13
|
+
spec.homepage = "https://github.com/sebglazebrook/test_flight_client"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'httmultiparty'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 2.14.1'
|
26
|
+
spec.add_development_dependency 'debugger'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: test_flight_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Seb Glazebrook
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httmultiparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.14.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.14.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: debugger
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Super simple ruby client for TestFlightApp's super simple developer API.
|
84
|
+
email:
|
85
|
+
- me@sebglazebrook.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- lib/test_flight_client.rb
|
96
|
+
- lib/test_flight_client/api_request.rb
|
97
|
+
- lib/test_flight_client/version.rb
|
98
|
+
- spec/lib/test_flight_client/api_request_spec.rb
|
99
|
+
- spec/lib/test_flight_client_spec.rb
|
100
|
+
- spec/spec_helper.rb
|
101
|
+
- test_flight_client.gemspec
|
102
|
+
homepage: https://github.com/sebglazebrook/test_flight_client
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.2.2
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Ruby client for TestFlightApp developer API.
|
126
|
+
test_files:
|
127
|
+
- spec/lib/test_flight_client/api_request_spec.rb
|
128
|
+
- spec/lib/test_flight_client_spec.rb
|
129
|
+
- spec/spec_helper.rb
|