jackie 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,18 @@
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
+ .ruby-version
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jackie.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Guillermo Iguaran
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,72 @@
1
+ # Jackie
2
+
3
+ A Ruby interface to the Kickfolio API.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'jackie'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install jackie
18
+
19
+ ## Usage
20
+
21
+ ### Configuring Jackie
22
+ ```ruby
23
+ # Set your Api Key
24
+ Jackie.api_key = "MyKickfolioApiKey"
25
+ ```
26
+ ### Basic Objects Operations
27
+ ```ruby
28
+ # Create New app
29
+ app = Jackie::App.new(app_attributes)
30
+ app.save
31
+
32
+ # Find the app with app_id 1.
33
+ app = Jackie::App.find(1)
34
+ app.name = "new name"
35
+ app.save
36
+
37
+ # GET the App versions
38
+ app.versions
39
+
40
+ # Delete a App
41
+ app.destroy
42
+
43
+ # GET the Apps
44
+ Jackie::App.all
45
+
46
+ # Create New App Version
47
+ version = Jackie::Version.new(:app_id => app.id, :bundle_url => "https://bundle_url.com/myiosapp")
48
+ version.save
49
+
50
+ # Find the version with version id 1.
51
+ version = Jackie::Version.find(1)
52
+
53
+ # GET All Versions
54
+ Jackie::Version.all
55
+
56
+ # Delete a Version
57
+ version.destroy
58
+ ```
59
+ ## Contributing
60
+
61
+ 1. Fork it
62
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
63
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
64
+ 4. Push to the branch (`git push origin my-new-feature`)
65
+ 5. Create new Pull Request
66
+
67
+ License
68
+ -------
69
+
70
+ Nuvado is Copyright © 2013 Firebase. It is free software,
71
+ and may be redistributed under the terms specified in the MIT-LICENSE file.
72
+
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ task :console do
6
+ puts "Loading development console..."
7
+ system("irb -r jackie")
8
+ end
9
+
10
+ task :help do
11
+ puts "Available rake tasks: "
12
+ puts "rake console - Run a IRB console with all enviroment loaded"
13
+ puts "rake test - Run tests"
14
+ end
15
+
16
+ task :test do
17
+ Dir.chdir('test')
18
+ end
19
+
20
+ Rake::TestTask.new(:test) do |t|
21
+ t.libs << '../lib'
22
+ t.libs << '../test'
23
+ t.test_files = FileList['*_test.rb']
24
+ t.verbose = false
25
+ end
26
+
27
+ task :default => :test
data/jackie.gemspec ADDED
@@ -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 'jackie'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jackie"
8
+ spec.version = Jackie::VERSION
9
+ spec.authors = ["Guillermo Iguaran", "Roberto Miranda", "Firebase.co"]
10
+ spec.email = ["guille@firebase.co", "roberto@firebase.co"]
11
+ spec.description = %q{A Ruby interface to the Kickfolio API.}
12
+ spec.summary = %q{A Ruby interface to the Kickfolio API}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency 'minitest'
24
+ spec.add_development_dependency 'mocha'
25
+
26
+ spec.add_dependency "activeresource", "4.0.0.beta1"
27
+ end
data/lib/jackie.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "base64"
2
+ require "active_resource"
3
+ require "jackie/base"
4
+ require "jackie/app"
5
+ require "jackie/version"
6
+
7
+ module Jackie
8
+ VERSION = "0.0.1"
9
+
10
+ def self.api_key=(api_key)
11
+ Jackie::Base.api_key = api_key
12
+ end
13
+ end
data/lib/jackie/app.rb ADDED
@@ -0,0 +1,11 @@
1
+ module Jackie
2
+ class App < Base
3
+ def last_preview_url
4
+ "http://kickfolio.com/w/#{public_key}"
5
+ end
6
+
7
+ def versions
8
+ Version.find(:all, :params => { :app_id => self.id })
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,22 @@
1
+ module Jackie
2
+ class Base < ActiveResource::Base
3
+ self.site = "http://kickfolio.com/api/"
4
+ headers['Accept'] = 'application/vnd.kickfolio.v1'
5
+
6
+ class << self
7
+ def headers
8
+ if defined?(@headers)
9
+ @headers
10
+ elsif superclass != Object && superclass.headers
11
+ superclass.headers
12
+ else
13
+ @headers ||= {}
14
+ end
15
+ end
16
+
17
+ def api_key=(api_key)
18
+ headers.merge!({'Authorization' => "Basic #{Base64.strict_encode64(api_key)}"})
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,7 @@
1
+ module Jackie
2
+ class Version < Base
3
+ def preview_url
4
+ "http://kickfolio.com/v/#{app_id}/version/#{id}"
5
+ end
6
+ end
7
+ end
data/test/app_test.rb ADDED
@@ -0,0 +1,16 @@
1
+ require "test_helper"
2
+ class AppTest < MiniTest::Unit::TestCase
3
+ mock_requests!
4
+
5
+ def setup
6
+ @app = Jackie::App.find(1)
7
+ end
8
+
9
+ def test_last_preview_url
10
+ assert_match @app.public_key, @app.last_preview_url
11
+ end
12
+
13
+ def test_versions
14
+ assert_kind_of ActiveResource::Collection, @app.versions
15
+ end
16
+ end
@@ -0,0 +1 @@
1
+ { name: "MyApp" }
@@ -0,0 +1,50 @@
1
+ testdir = File.dirname(__FILE__)
2
+ $LOAD_PATH.unshift testdir unless $LOAD_PATH.include?(testdir)
3
+
4
+ libdir = File.dirname(File.dirname(__FILE__)) + '/lib'
5
+ $LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)
6
+
7
+ require "rubygems"
8
+ require "jackie"
9
+ require "minitest/unit"
10
+ require "minitest/autorun"
11
+
12
+ Jackie.api_key = "MyKickfolioApiKey"
13
+
14
+ class MiniTest::Unit::TestCase
15
+ def self.mock_requests!
16
+ # FIXME move to fixture module
17
+ @app = { "id" => "1",
18
+ "user_id"=>"1",
19
+ "name"=>"firebaseco",
20
+ "public_key"=>"zOBZ6A",
21
+ "bundle"=>"firebaeco",
22
+ "icon"=>nil,
23
+ "default_to_landscape"=>false,
24
+ "device_type"=>"iPad",
25
+ "created_at"=>"2013-02-21T20:16:23Z",
26
+ "updated_at"=>"2013-02-21T20:16:28Z",
27
+ "version_ids"=>["81965734-28b3-45e3-b8ca-837823e4e18c"]
28
+ }.to_json
29
+
30
+ @version = {"id"=>"1",
31
+ "app_id"=>"1",
32
+ "state"=>"ready",
33
+ "bundle_url"=>"https://dl.dropbox.com/s/1",
34
+ "encrypted_bundle_url"=>"3qI/PmSqZdT1v6sgYJNzhw==",
35
+ "version_string"=>"1.0",
36
+ "default_image"=>nil,
37
+ "default_image_landscape"=>nil,
38
+ "has_job_id"=>false,
39
+ "created_at"=>"2013-02-21T20:16:24Z",
40
+ "updated_at"=>"2013-02-21T20:16:28Z",
41
+ "comment_ids"=>[]}
42
+
43
+ @headers = {"Accept"=>"application/vnd.kickfolio.v1", "Authorization"=>"Basic TXlLaWNrZm9saW9BcGlLZXk="}
44
+ ActiveResource::HttpMock.respond_to do |mock|
45
+ mock.get "/api/apps/1.json", @headers, @app
46
+ mock.get "/api/versions.json?app_id=1", @headers, [@version].to_json
47
+ mock.get "/api/versions/1.json", @headers, @version.to_json
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,13 @@
1
+ require "test_helper"
2
+ class VersionTest < MiniTest::Unit::TestCase
3
+ mock_requests!
4
+
5
+ def setup
6
+ @version = Jackie::Version.find(1)
7
+ end
8
+
9
+ def test_preview_url
10
+ assert_match @version.app_id, @version.preview_url
11
+ assert_match @version.id, @version.preview_url
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jackie
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Guillermo Iguaran
9
+ - Roberto Miranda
10
+ - Firebase.co
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2013-03-16 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: bundler
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: '1.3'
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: '1.3'
32
+ - !ruby/object:Gem::Dependency
33
+ name: rake
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: minitest
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ - !ruby/object:Gem::Dependency
65
+ name: mocha
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ type: :development
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ - !ruby/object:Gem::Dependency
81
+ name: activeresource
82
+ requirement: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - '='
86
+ - !ruby/object:Gem::Version
87
+ version: 4.0.0.beta1
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - '='
94
+ - !ruby/object:Gem::Version
95
+ version: 4.0.0.beta1
96
+ description: A Ruby interface to the Kickfolio API.
97
+ email:
98
+ - guille@firebase.co
99
+ - roberto@firebase.co
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - jackie.gemspec
110
+ - lib/jackie.rb
111
+ - lib/jackie/app.rb
112
+ - lib/jackie/base.rb
113
+ - lib/jackie/version.rb
114
+ - test/app_test.rb
115
+ - test/fixtures/app.json
116
+ - test/test_helper.rb
117
+ - test/version_test.rb
118
+ homepage: ''
119
+ licenses:
120
+ - MIT
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 1.8.25
140
+ signing_key:
141
+ specification_version: 3
142
+ summary: A Ruby interface to the Kickfolio API
143
+ test_files:
144
+ - test/app_test.rb
145
+ - test/fixtures/app.json
146
+ - test/test_helper.rb
147
+ - test/version_test.rb