korboard 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in korboard.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/Readme.md ADDED
File without changes
data/korboard.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "korboard/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "korboard"
7
+ s.version = Korboard::VERSION
8
+ s.authors = ["Sean Reilly"]
9
+ s.email = ["reillyse@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Korboard Client API}
12
+ s.description = %q{This gem allows developers to access the Korboard API from their app using Ruby}
13
+
14
+ s.rubyforge_project = "korboard"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ end
data/lib/korboard.rb ADDED
@@ -0,0 +1,11 @@
1
+ require "korboard/version"
2
+ require "korboard/railtie"
3
+ require "korboard/client"
4
+ module Korboard
5
+ # Your code goes here...
6
+ end
7
+
8
+
9
+ # new product per iteration/ test
10
+ # cust id is user id
11
+ # bit on user table to tell us if we sign up through korboard
@@ -0,0 +1,52 @@
1
+ require 'net/http'
2
+ require 'net/https'
3
+ require 'json'
4
+ require 'active_support/inflector'
5
+
6
+ class Korboard::Client
7
+
8
+ def initialize
9
+
10
+
11
+ @token = ::Rails.application.config.korboard.api_token
12
+ @iteration_number = ::Rails.application.config.korboard.iteration_number
13
+ @http = Net::HTTP.new('api.korboard.com')
14
+ @headers = {
15
+ 'Content-Type' => 'application/json'
16
+ }
17
+ end
18
+
19
+ # can do this for the rest too
20
+ def record_signup identifier,options=nil
21
+ record :signup,@iteration_number,identifier,options
22
+ end
23
+
24
+ def record_visit identifier,options=nil
25
+ record :signup,@iteration_number,identifier,options
26
+ end
27
+
28
+
29
+
30
+ def record metric ,iteration_number, identifier, options =nil
31
+ data = { :signup => { :identifier => identifier }, :iteration => { :number => iteration_number } }
32
+ data.merge(options) if options
33
+
34
+ path = "/v1.1/#{metric.to_s.pluralize}?token=#{@token}"
35
+
36
+ resp, data = @http.post(path, data.to_json, @headers)
37
+
38
+ print_response(resp,data) unless resp.code.to_i == 201
39
+ return resp.code.to_i == 201
40
+
41
+ end
42
+
43
+
44
+
45
+ def print_response(resp,data)
46
+ puts 'Code = ' + resp.code
47
+ puts 'Message = ' + resp.message
48
+ resp.each {|key, val| puts key + ' = ' + val}
49
+ puts data
50
+ end
51
+
52
+ end
@@ -0,0 +1,10 @@
1
+ require 'rails'
2
+ class Korboard::Railtie < Rails::Railtie
3
+ config.korboard = ActiveSupport::OrderedOptions.new
4
+
5
+ initializer "korboard.configure" do |app|
6
+ # Korboard.configure do |config|
7
+ # config.key = app.config.korboard[:key]
8
+ # end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module Korboard
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: korboard
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sean Reilly
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-06 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: This gem allows developers to access the Korboard API from their app
15
+ using Ruby
16
+ email:
17
+ - reillyse@gmail.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - Rakefile
25
+ - Readme.md
26
+ - korboard.gemspec
27
+ - lib/korboard.rb
28
+ - lib/korboard/client.rb
29
+ - lib/korboard/railtie.rb
30
+ - lib/korboard/version.rb
31
+ homepage: ''
32
+ licenses: []
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubyforge_project: korboard
51
+ rubygems_version: 1.8.10
52
+ signing_key:
53
+ specification_version: 3
54
+ summary: Korboard Client API
55
+ test_files: []