big-panda 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
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
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rvmrc ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use 1.9.3" > .rvmrc
9
+ environment_id="ruby-1.9.3-p327@bigp_anda"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.17.0 (master)" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
+ if [[ $- == *i* ]] # check for interactive shells
29
+ then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
30
+ else echo "Using: $GEM_HOME" # don't use colors in non-interactive shells
31
+ fi
32
+ else
33
+ # If the environment file has not yet been created, use the RVM CLI to select.
34
+ rvm --create use "$environment_id" || {
35
+ echo "Failed to create RVM environment '${environment_id}'."
36
+ return 1
37
+ }
38
+ fi
39
+
40
+ # If you use bundler, this might be useful to you:
41
+ # if [[ -s Gemfile ]] && {
42
+ # ! builtin command -v bundle >/dev/null ||
43
+ # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
44
+ # }
45
+ # then
46
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
47
+ # gem install bundler
48
+ # fi
49
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
50
+ # then
51
+ # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
52
+ # fi
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - jruby-19mode
5
+ - 2.0.0
6
+ matrix:
7
+ allow_failures:
8
+ - rvm: 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in big_panda.gemspec
4
+ gemspec
5
+
6
+ gem 'rake'
7
+
8
+
9
+ group :development, :test do
10
+ gem 'debugger', :platforms => :mri_19
11
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Gregory Man
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.
@@ -0,0 +1,68 @@
1
+ # BigPanda
2
+
3
+ [![Build Status](https://travis-ci.org/gregory-m/big-panda.png?branch=master)](https://travis-ci.org/gregory-m/big-panda) [![Dependency Status](https://gemnasium.com/gregory-m/big-panda.png)](https://gemnasium.com/gregory-m/big-panda)
4
+
5
+ A Ruby interface to the Big Panda API.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'big-panda'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install big-panda
20
+
21
+ ## Usage
22
+
23
+ ### Simple Usage:
24
+
25
+ ```ruby
26
+ require 'big_panda'
27
+
28
+ panda = BigPanda::Client.new(access_token: 'my-access-token')
29
+ # => #<BigPanda::Client:0x007f8a39a07038 @target_url="https://api.bigpanda.io", @access_token="my-access-token">
30
+
31
+ panda.start_deployment({ component: 'html-editor', version: '123' })
32
+ # => {"status"=>"created", "id"=>"513382af21e4d3fc5800d01a"}
33
+
34
+ panda.finish_deployment({ component: 'html-editor', version: '123' })
35
+ # => {"status"=>"created", "id"=>"5133831091ad50246f00f089"}
36
+ ```
37
+
38
+ ### Advanced Usage:
39
+
40
+ ```ruby
41
+ require 'big_panda'
42
+
43
+ panda = BigPanda::Client.new(access_token: 'my-access-token')
44
+ # => #<BigPanda::Client:0x007f8a39a07038 @target_url="https://api.bigpanda.io", @access_token="my-access-token">
45
+
46
+ panda.start_deployment({ component: 'html-editor', version: '123',
47
+ timestamp: Time.now.to_i, description: 'Deploying new version',
48
+ owner: 'Gregory Man', env: 'Production', source: 'chef',
49
+ hosts: ['a1.wix.com', 'a2.wix.com']
50
+ })
51
+ # => {"status"=>"created", "id"=>"51338369b4a7ea843100ceb3"}
52
+
53
+
54
+ panda.finish_deployment({ component: 'html-editor', version: '123',
55
+ timestamp: Time.now.to_i, status: 'failure', errorMessage: 'Ooops',
56
+ hosts: ['a1.wix.com', 'a2.wix.com']
57
+ })
58
+ # => {"status"=>"created", "id"=>"513383e021e4d3fc5800d02d"}
59
+ ```
60
+
61
+
62
+ ## Contributing
63
+
64
+ 1. Fork it
65
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
66
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
67
+ 4. Push to the branch (`git push origin my-new-feature`)
68
+ 5. Create new Pull Request
@@ -0,0 +1,23 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new('spec')
6
+
7
+ task default: 'spec'
8
+
9
+
10
+ module Bundler
11
+ class GemHelper
12
+ protected
13
+ def tag_version
14
+ sh "git tag -s -a -m \"Version #{version}\" #{version_tag}"
15
+ Bundler.ui.confirm "Tagged #{version_tag}"
16
+ yield if block_given?
17
+ rescue
18
+ Bundler.ui.error "Untagged #{version_tag} due to error"
19
+ sh_with_code "git tag -d #{version_tag}"
20
+ raise
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'big_panda/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "big-panda"
8
+ gem.version = BigPanda::VERSION
9
+ gem.authors = ["Gregory Man"]
10
+ gem.email = ["man.gregory@gmail.com"]
11
+ gem.description = %q{A Ruby interface to the Big Panda API}
12
+ gem.summary = gem.description
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_runtime_dependency 'multi_json', '~> 1.6'
21
+ gem.add_runtime_dependency 'faraday_middleware', '~> 0.9'
22
+
23
+ gem.add_development_dependency 'rspec', '~> 2.13'
24
+ gem.add_development_dependency 'webmock', '~> 1.10'
25
+ gem.add_development_dependency 'vcr', '~> 2.4'
26
+ end
@@ -0,0 +1,10 @@
1
+ require "big_panda/version"
2
+ require "big_panda/helper"
3
+ require "big_panda/client"
4
+
5
+
6
+ module BigPanda
7
+ DEFAULT_TARGET_URL = 'https://api.bigpanda.io'
8
+ DEPLOYMENT_START_PATH = '/data/events/deployments/start'
9
+ DEPLOYMENT_END_PATH = '/data/events/deployments/end'
10
+ end
@@ -0,0 +1,23 @@
1
+ require 'big_panda/client/connection'
2
+ require 'big_panda/client/request'
3
+ require 'big_panda/client/deployment'
4
+
5
+ module BigPanda
6
+ class Client
7
+ include BigPanda::Helper
8
+ include Connection
9
+ include Request
10
+ include Deployment
11
+
12
+ attr_reader :access_token, :target_url
13
+
14
+ def initialize(options={})
15
+ @target_url = BigPanda::DEFAULT_TARGET_URL
16
+
17
+ mandatory_options = [ :access_token ]
18
+ check_mandatory_options(options, mandatory_options)
19
+ @access_token = options[:access_token]
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ require 'faraday_middleware'
2
+
3
+ module BigPanda
4
+ class Client
5
+ module Connection
6
+ private
7
+
8
+ def connection
9
+ Faraday.new(url: target_url) do |faraday|
10
+ faraday.use FaradayMiddleware::EncodeJson
11
+ faraday.use FaradayMiddleware::ParseJson
12
+ faraday.adapter Faraday.default_adapter
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,72 @@
1
+ module BigPanda
2
+ class Client
3
+ module Deployment
4
+
5
+ # Public: Send start_deployment request
6
+ # Use this method to include deployments on your timeline.
7
+ #
8
+ # options - Deployment options
9
+ # Mandatory:
10
+ # options[:component] - Name of component
11
+ # options[:version] - Component version
12
+ # Optional:
13
+ # options[:timestamp] - UTC timestamp of the deployment event (default: UTC.Now)
14
+ # options[:description] - Free text description of the deployment
15
+ # options[:owner] - The person responsible for the deployment
16
+ # options[:env] - Environment to which the component was deployed (e.g Prod, Staging, Dev, etc.)
17
+ # options[:source] - Deployment event source (e.g. Chef, Pupet, Capistrano, etc)
18
+ # options[:hosts] - Array of hosts to to which the component was deployed (e.g. ['a1.wix.com', 'a2.wix.com'])
19
+ #
20
+ # Examples:
21
+ #
22
+ # start_deployment({ component: 'html-editor', version: '123' })
23
+ # # => {"status"=>"created", "id"=>"513363c091ad50246f00eec9"}
24
+ #
25
+ # start_deployment({ component: 'html-editor', version: '123',
26
+ # timestamp: Time.now.to_i, description: 'Deploying new version',
27
+ # owner: 'Gregory Man', env: 'Production', source: 'chef',
28
+ # hosts: ['a1.wix.com', 'a2.wix.com'] })
29
+ # # => {"status"=>"created", "id"=>"51336b39b4a7ea843100cdb8"}
30
+ #
31
+ # Returns deployment status and ID
32
+ def start_deployment(options)
33
+ mandatory_options = [ :component, :version ]
34
+ check_mandatory_options(options, mandatory_options)
35
+
36
+ response = post(BigPanda::DEPLOYMENT_START_PATH, body: options)
37
+ response['response']
38
+ end
39
+
40
+ # Public: Send finish_deployment request
41
+ # Call this method to declare the end of the deployment process.
42
+ # The end event is optional.
43
+ #
44
+ # options - Deployment options
45
+ # Mandatory:
46
+ # options[:component] - Name of component
47
+ # options[:version] - Component version
48
+ # Optional:
49
+ # options[:timestamp] - UTC timestamp of the deployment event (default: UTC.Now)
50
+ # options[:hosts] - Array of hosts to to which the component was deployed (e.g. ['a1.wix.com', 'a2.wix.com'])
51
+ #
52
+ # Examples:
53
+ #
54
+ # finish_deployment({ component: 'html-editor', version: '123' })
55
+ # # => {"status"=>"created", "id"=>"51336fd391ad50246f00efb3"}
56
+ #
57
+ # finish_deployment({ component: 'html-editor', version: '123',
58
+ # timestamp: Time.now.to_i, status: 'failure', errorMessage: 'Ooops',
59
+ # hosts: ['a1.wix.com', 'a2.wix.com']})
60
+ # # => {"status"=>"created", "id"=>"51336b39b4a7ea843100cdb8"}
61
+ #
62
+ # Returns status and ID
63
+ def finish_deployment(options)
64
+ mandatory_options = [ :component, :version ]
65
+ check_mandatory_options(options, mandatory_options)
66
+
67
+ response = post(BigPanda::DEPLOYMENT_END_PATH, body: options)
68
+ response['response']
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,21 @@
1
+ module BigPanda
2
+ class Client
3
+ module Request
4
+ def post(path, options={})
5
+ request(:post, path, options)
6
+ end
7
+
8
+ private
9
+
10
+ def request(action, path, options)
11
+ response = connection.send(action, path) do |request|
12
+ request.body = options[:body] if options[:body]
13
+ request.headers['authorization'] = "Bearer #{access_token}"
14
+ request.headers['Accept'] = "application/json"
15
+ end
16
+
17
+ response.body
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ module BigPanda
2
+ module Helper
3
+ def check_mandatory_options(options={}, mandatory_options=[])
4
+ mandatory_options.each do |option|
5
+ if options[option].nil?
6
+ raise ArgumentError.new("option #{option} is mandatory")
7
+ end
8
+ end
9
+ true
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module BigPanda
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,88 @@
1
+ require "spec_helper"
2
+
3
+ describe BigPanda::Client::Deployment do
4
+ let(:access_token) { 'my-access-token' }
5
+
6
+ subject { BigPanda::Client.new(access_token: access_token) }
7
+
8
+ describe ".start_deployment" do
9
+ let(:response) { subject.start_deployment(options) }
10
+
11
+ context "withut mandatory options" do
12
+ let(:options) { {} }
13
+
14
+ it "raise Argumnt Error" do
15
+ expect { response }.to raise_error(ArgumentError)
16
+ end
17
+ end
18
+
19
+ context "with all mandatory params", vcr: { cassette_name: 'start_deployment' } do
20
+
21
+ let(:options) { { component: 'html-editor', version: '123' } }
22
+
23
+ it "return status" do
24
+ response['status'].should == 'created'
25
+ end
26
+
27
+ it "return id" do
28
+ response['id'].should_not be_empty
29
+ end
30
+ end
31
+
32
+ context "with all aoptional params", vcr: { cassette_name: 'start_deployment_with_optional' } do
33
+ let(:options) {{
34
+ component: 'html-editor', version: '123', timestamp: Time.now.to_i,
35
+ description: 'Deploying new version', owner: 'Gregory Man',
36
+ env: 'Production', source: 'chef', hosts: ['a1.wix.com', 'a2.wix.com']
37
+ }}
38
+
39
+ it "return status" do
40
+ response['status'].should == 'created'
41
+ end
42
+
43
+ it "return id" do
44
+ response['id'].should_not be_empty
45
+ end
46
+ end
47
+ end
48
+
49
+ describe ".start_deployment" do
50
+ let(:response) { subject.finish_deployment(options) }
51
+
52
+ context "without mandatory options" do
53
+ let(:options) { {} }
54
+
55
+ it "raise Argumnt Error" do
56
+ expect { response }.to raise_error(ArgumentError)
57
+ end
58
+ end
59
+
60
+ context "with mandatory params", vcr: { cassette_name: 'finish_deployment' } do
61
+ let(:options) { { component: 'html-editor', version: '123' } }
62
+
63
+ it "return status" do
64
+ response['status'].should == 'created'
65
+ end
66
+
67
+ it "return id" do
68
+ response['id'].should_not be_empty
69
+ end
70
+ end
71
+
72
+ context "with optional params", vcr: { cassette_name: 'finish_deployment_with_optional' } do
73
+ let(:options) {{
74
+ component: 'html-editor', version: '123', timestamp: Time.now.to_i,
75
+ status: 'failure', errorMessage: 'Ooops', hosts: ['a1.wix.com', 'a2.wix.com']
76
+ }}
77
+
78
+ it "return status" do
79
+ response['status'].should == 'created'
80
+ end
81
+
82
+ it "return id" do
83
+ response['id'].should_not be_empty
84
+ end
85
+ end
86
+ end
87
+
88
+ end
@@ -0,0 +1,30 @@
1
+ require "spec_helper"
2
+
3
+ describe BigPanda::Client do
4
+ let(:target_url) { 'https://api.bigpanda.io' }
5
+
6
+ describe "#initialize" do
7
+
8
+ subject { BigPanda::Client }
9
+
10
+ context "without access_token" do
11
+ it "raise Argument Error" do
12
+ expect { subject.new }.to raise_error(ArgumentError)
13
+ end
14
+ end
15
+
16
+ context "with all mandatory options" do
17
+ let(:options) { { access_token: 'my-access-token' } }
18
+ subject { BigPanda::Client.new(options) }
19
+
20
+ it "not raise errors" do
21
+ subject
22
+ end
23
+
24
+ it "set default target URL" do
25
+ subject.target_url.should == target_url
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,33 @@
1
+ require "spec_helper"
2
+
3
+ describe BigPanda::Helper do
4
+ include BigPanda::Helper
5
+
6
+ describe ".check_mandatory_options" do
7
+ let(:options) { { auth_token: '123', url: 'http://google.com' } }
8
+
9
+ context "with all mandatory options" do
10
+ let(:mandatory_options) { [:auth_token] }
11
+
12
+ it "return true" do
13
+ check_mandatory_options(options, mandatory_options).should be_true
14
+ end
15
+ end
16
+
17
+ context "without all mandatory options" do
18
+ let(:mandatory_options) { [:auth_token, :not_existing_option] }
19
+
20
+ it "raise ArgumentError" do
21
+ expect {
22
+ check_mandatory_options(options, mandatory_options)
23
+ }.to raise_error(ArgumentError)
24
+ end
25
+
26
+ it "provides message with option name" do
27
+ expect {
28
+ check_mandatory_options(options, mandatory_options)
29
+ }.to raise_error(ArgumentError, 'option not_existing_option is mandatory')
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,47 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.bigpanda.io/data/events/deployments/end
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"component":"html-editor","version":"123"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.6
12
+ Authorization:
13
+ - Bearer my-access-token
14
+ Accept:
15
+ - application/json
16
+ Content-Type:
17
+ - application/json
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Server:
24
+ - nginx/1.2.7
25
+ Date:
26
+ - Sun, 03 Mar 2013 15:44:19 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '85'
31
+ Connection:
32
+ - keep-alive
33
+ X-Powered-By:
34
+ - Express
35
+ Access-Control-Allow-Origin:
36
+ - ! '*'
37
+ Access-Control-Allow-Methods:
38
+ - GET, POST, DELETE, PUT, OPTIONS
39
+ Access-Control-Allow-Headers:
40
+ - Content-Type
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! "{\n \"response\": {\n \"status\": \"created\",\n \"id\": \"51336fd391ad50246f00efb3\"\n
44
+ \ }\n}"
45
+ http_version:
46
+ recorded_at: Sun, 03 Mar 2013 15:44:19 GMT
47
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,47 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.bigpanda.io/data/events/deployments/end
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"component":"html-editor","version":"123","timestamp":1362325841,"status":"failure","errorMessage":"Ooops","hosts":["a1.wix.com","a2.wix.com"]}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.6
12
+ Authorization:
13
+ - Bearer my-access-token
14
+ Accept:
15
+ - application/json
16
+ Content-Type:
17
+ - application/json
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Server:
24
+ - nginx/1.2.7
25
+ Date:
26
+ - Sun, 03 Mar 2013 15:50:43 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '85'
31
+ Connection:
32
+ - keep-alive
33
+ X-Powered-By:
34
+ - Express
35
+ Access-Control-Allow-Origin:
36
+ - ! '*'
37
+ Access-Control-Allow-Methods:
38
+ - GET, POST, DELETE, PUT, OPTIONS
39
+ Access-Control-Allow-Headers:
40
+ - Content-Type
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! "{\n \"response\": {\n \"status\": \"created\",\n \"id\": \"51337153b4a7ea843100cdfc\"\n
44
+ \ }\n}"
45
+ http_version:
46
+ recorded_at: Sun, 03 Mar 2013 15:50:43 GMT
47
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,47 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.bigpanda.io/data/events/deployments/start
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"component":"html-editor","version":"123"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.6
12
+ Authorization:
13
+ - Bearer my-access-token
14
+ Accept:
15
+ - application/json
16
+ Content-Type:
17
+ - application/json
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Server:
24
+ - nginx/1.2.7
25
+ Date:
26
+ - Sun, 03 Mar 2013 14:52:48 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '85'
31
+ Connection:
32
+ - keep-alive
33
+ X-Powered-By:
34
+ - Express
35
+ Access-Control-Allow-Origin:
36
+ - ! '*'
37
+ Access-Control-Allow-Methods:
38
+ - GET, POST, DELETE, PUT, OPTIONS
39
+ Access-Control-Allow-Headers:
40
+ - Content-Type
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! "{\n \"response\": {\n \"status\": \"created\",\n \"id\": \"513363c091ad50246f00eec9\"\n
44
+ \ }\n}"
45
+ http_version:
46
+ recorded_at: Sun, 03 Mar 2013 14:52:47 GMT
47
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.bigpanda.io/data/events/deployments/start
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"component":"html-editor","version":"123","timestamp":1362324279,"description":"Deploying
9
+ new version","owner":"Gregory Man","env":"Production","source":"chef","hosts":["a1.wix.com","a2.wix.com"]}'
10
+ headers:
11
+ User-Agent:
12
+ - Faraday v0.8.6
13
+ Authorization:
14
+ - Bearer my-access-token
15
+ Accept:
16
+ - application/json
17
+ Content-Type:
18
+ - application/json
19
+ response:
20
+ status:
21
+ code: 201
22
+ message: Created
23
+ headers:
24
+ Server:
25
+ - nginx/1.2.7
26
+ Date:
27
+ - Sun, 03 Mar 2013 15:24:41 GMT
28
+ Content-Type:
29
+ - application/json; charset=utf-8
30
+ Content-Length:
31
+ - '85'
32
+ Connection:
33
+ - keep-alive
34
+ X-Powered-By:
35
+ - Express
36
+ Access-Control-Allow-Origin:
37
+ - ! '*'
38
+ Access-Control-Allow-Methods:
39
+ - GET, POST, DELETE, PUT, OPTIONS
40
+ Access-Control-Allow-Headers:
41
+ - Content-Type
42
+ body:
43
+ encoding: US-ASCII
44
+ string: ! "{\n \"response\": {\n \"status\": \"created\",\n \"id\": \"51336b39b4a7ea843100cdb8\"\n
45
+ \ }\n}"
46
+ http_version:
47
+ recorded_at: Sun, 03 Mar 2013 15:24:41 GMT
48
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,15 @@
1
+ require 'bundler/setup'
2
+ require 'big_panda'
3
+
4
+ require 'vcr'
5
+
6
+ RSpec.configure do |config|
7
+ config.treat_symbols_as_metadata_keys_with_true_values = true
8
+ end
9
+
10
+ VCR.configure do |c|
11
+ c.cassette_library_dir = 'spec/fixtures/cassettes'
12
+ c.hook_into :webmock
13
+ c.default_cassette_options = { record: :new_episodes }
14
+ c.configure_rspec_metadata!
15
+ end
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: big-panda
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Gregory Man
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: multi_json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.6'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.6'
30
+ - !ruby/object:Gem::Dependency
31
+ name: faraday_middleware
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '0.9'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '0.9'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2.13'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.13'
62
+ - !ruby/object:Gem::Dependency
63
+ name: webmock
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.10'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.10'
78
+ - !ruby/object:Gem::Dependency
79
+ name: vcr
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '2.4'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '2.4'
94
+ description: A Ruby interface to the Big Panda API
95
+ email:
96
+ - man.gregory@gmail.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - .gitignore
102
+ - .rspec
103
+ - .rvmrc
104
+ - .travis.yml
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - big_panda.gemspec
110
+ - lib/big_panda.rb
111
+ - lib/big_panda/client.rb
112
+ - lib/big_panda/client/connection.rb
113
+ - lib/big_panda/client/deployment.rb
114
+ - lib/big_panda/client/request.rb
115
+ - lib/big_panda/helper.rb
116
+ - lib/big_panda/version.rb
117
+ - spec/big_panda/client/deployment_spec.rb
118
+ - spec/big_panda/client_spec.rb
119
+ - spec/big_panda/helper_spec.rb
120
+ - spec/fixtures/cassettes/finish_deployment.yml
121
+ - spec/fixtures/cassettes/finish_deployment_with_optional.yml
122
+ - spec/fixtures/cassettes/start_deployment.yml
123
+ - spec/fixtures/cassettes/start_deployment_with_optional.yml
124
+ - spec/spec_helper.rb
125
+ homepage: ''
126
+ licenses: []
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ segments:
138
+ - 0
139
+ hash: -4393814194179670104
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ segments:
147
+ - 0
148
+ hash: -4393814194179670104
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 1.8.24
152
+ signing_key:
153
+ specification_version: 3
154
+ summary: A Ruby interface to the Big Panda API
155
+ test_files:
156
+ - spec/big_panda/client/deployment_spec.rb
157
+ - spec/big_panda/client_spec.rb
158
+ - spec/big_panda/helper_spec.rb
159
+ - spec/fixtures/cassettes/finish_deployment.yml
160
+ - spec/fixtures/cassettes/finish_deployment_with_optional.yml
161
+ - spec/fixtures/cassettes/start_deployment.yml
162
+ - spec/fixtures/cassettes/start_deployment_with_optional.yml
163
+ - spec/spec_helper.rb