proper_process_api_ares 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.rdoc +3 -0
- data/Rakefile +9 -0
- data/config/proper_process.sample.yml +1 -0
- data/lib/proper_process_api_ares.rb +38 -0
- data/lib/proper_process_api_ares/version.rb +3 -0
- data/proper_process_api_ares.gemspec +24 -0
- data/test/test_procedure.rb +40 -0
- metadata +89 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
api_key: youtapikey
|
@@ -0,0 +1,38 @@
|
|
1
|
+
begin
|
2
|
+
require 'active_resource'
|
3
|
+
rescue LoadError
|
4
|
+
begin
|
5
|
+
require 'rubygems'
|
6
|
+
require 'active_resource'
|
7
|
+
rescue LoadError
|
8
|
+
abort "Unable to load activeresource.\n You can install it using gem install activeresoruce"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
require "proper_process_api_ares/version"
|
13
|
+
|
14
|
+
module ProperProcess
|
15
|
+
class << self
|
16
|
+
attr_accessor :site, :api_key
|
17
|
+
def configure
|
18
|
+
yield self
|
19
|
+
|
20
|
+
Base.user = api_key
|
21
|
+
Base.password = 'x'
|
22
|
+
|
23
|
+
self.site ||= "http://properprocess.com"
|
24
|
+
Base.site = site
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Base < ActiveResource::Base
|
29
|
+
def to_xml(options = {})
|
30
|
+
options.merge!(:dasherize => false)
|
31
|
+
super
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Procedure < Base
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "proper_process_api_ares/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "proper_process_api_ares"
|
7
|
+
s.version = ProperProcessApiAres::VERSION
|
8
|
+
s.authors = ["Aldwin Ibuna"]
|
9
|
+
s.email = ["aibuna@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/dwinph/proper_process_api_ares"
|
11
|
+
s.summary = %q{An wrapper for Proper Process API}
|
12
|
+
s.description = %q{API wrapper for Proper Process API using ActiveResource}
|
13
|
+
|
14
|
+
s.rubyforge_project = "proper_process_api_ares"
|
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 "fakeweb"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
2
|
+
require 'test/unit'
|
3
|
+
require 'proper_process_api_ares'
|
4
|
+
require 'fakeweb'
|
5
|
+
|
6
|
+
class ProcedureTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
# Simulate a YAML config file
|
10
|
+
@test_config = { "api_key" => "f64eedc6649c0b8968eabfc0eb0b1c52d2c5e783", "site" => "http://example.com"}
|
11
|
+
|
12
|
+
ProperProcess.configure do |c|
|
13
|
+
c.site = @test_config['site']
|
14
|
+
c.api_key = @test_config['api_key']
|
15
|
+
end
|
16
|
+
|
17
|
+
FakeWeb.allow_net_connect = false
|
18
|
+
end
|
19
|
+
|
20
|
+
def teardown
|
21
|
+
FakeWeb.allow_net_connect = true
|
22
|
+
FakeWeb.clean_registry
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_should_get_all_procedures
|
26
|
+
FakeWeb.register_uri(:get, "http://#{@test_config['api_key']}:x@example.com/procedures.json", :body => '[{"procedure":{"snapshots_count":null,"name":"Procedure 3 Testing schedules","created_at":null,"assets_count":0,"updated_at":null,"overview":"<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>","orig_source_id":null,"account_id":2,"id":3,"sample_request":null,"requirements":null,"company_id":2,"responsible_user_id":710149061,"is_public":false,"description":"<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>"}},{"procedure":{"snapshots_count":null,"name":"Validation Tests on creating schedules","created_at":null,"assets_count":0,"updated_at":null,"overview":null,"orig_source_id":null,"account_id":2,"id":4,"sample_request":null,"requirements":null,"company_id":2,"responsible_user_id":710149061,"is_public":false,"description":null}}]')
|
27
|
+
procedures = ProperProcess::Procedure.find(:all)
|
28
|
+
assert_not_nil procedures
|
29
|
+
assert procedures.kind_of? Array
|
30
|
+
assert_equal 2, procedures.size
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_should_get_a_procedure
|
34
|
+
FakeWeb.register_uri(:get, "http://#{@test_config['api_key']}:x@example.com/procedures/3.json", :body => '{"procedure":{"snapshots_count":null,"name":"Procedure 3 Testing schedules","created_at":null,"assets_count":0,"updated_at":null,"overview":"<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>","orig_source_id":null,"account_id":2,"id":3,"sample_request":null,"requirements":null,"company_id":2,"responsible_user_id":710149061,"is_public":false,"description":"<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>"}}' )
|
35
|
+
procedure = ProperProcess::Procedure.find(3)
|
36
|
+
assert_not_nil procedure
|
37
|
+
assert procedure.kind_of? ProperProcess::Procedure
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: proper_process_api_ares
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Aldwin Ibuna
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-02-02 00:00:00 +08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: fakeweb
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
description: API wrapper for Proper Process API using ActiveResource
|
36
|
+
email:
|
37
|
+
- aibuna@gmail.com
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- Gemfile
|
47
|
+
- README.rdoc
|
48
|
+
- Rakefile
|
49
|
+
- config/proper_process.sample.yml
|
50
|
+
- lib/proper_process_api_ares.rb
|
51
|
+
- lib/proper_process_api_ares/version.rb
|
52
|
+
- proper_process_api_ares.gemspec
|
53
|
+
- test/test_procedure.rb
|
54
|
+
has_rdoc: true
|
55
|
+
homepage: https://github.com/dwinph/proper_process_api_ares
|
56
|
+
licenses: []
|
57
|
+
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
version: "0"
|
81
|
+
requirements: []
|
82
|
+
|
83
|
+
rubyforge_project: proper_process_api_ares
|
84
|
+
rubygems_version: 1.6.2
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: An wrapper for Proper Process API
|
88
|
+
test_files:
|
89
|
+
- test/test_procedure.rb
|