whereistand 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.
@@ -0,0 +1 @@
1
+ v0.0.1. initial release
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "yajl-ruby"
4
+
5
+ group :development do
6
+ gem "parka"
7
+ end
8
+
9
+ group :test do
10
+ gem "rspec"
11
+ end
@@ -0,0 +1,22 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ rspec (2.0.1)
6
+ rspec-core (~> 2.0.1)
7
+ rspec-expectations (~> 2.0.1)
8
+ rspec-mocks (~> 2.0.1)
9
+ rspec-core (2.0.1)
10
+ rspec-expectations (2.0.1)
11
+ diff-lcs (>= 1.1.2)
12
+ rspec-mocks (2.0.1)
13
+ rspec-core (~> 2.0.1)
14
+ rspec-expectations (~> 2.0.1)
15
+ yajl-ruby (0.7.8)
16
+
17
+ PLATFORMS
18
+ ruby
19
+
20
+ DEPENDENCIES
21
+ rspec
22
+ yajl-ruby
data/LICENSE ADDED
File without changes
@@ -0,0 +1,24 @@
1
+ CHANGELOG
2
+ Gemfile
3
+ Gemfile.lock
4
+ LICENSE
5
+ README
6
+ Rakefile
7
+ lib/client/access.rb
8
+ lib/dom/account.rb
9
+ lib/dom/account_issues.rb
10
+ lib/dom/account_results.rb
11
+ lib/dom/approved_opinion.rb
12
+ lib/dom/evidenced_opinion.rb
13
+ lib/dom/expressed_opinion.rb
14
+ lib/dom/issue.rb
15
+ lib/dom/issue_accounts.rb
16
+ lib/dom/issue_result.rb
17
+ lib/dom/issue_results.rb
18
+ lib/dom/opinion.rb
19
+ lib/dom/results.rb
20
+ lib/dom/unknown_opinion.rb
21
+ lib/dom/unverified_opinion.rb
22
+ lib/rubysdk.rb
23
+ spec/client_access_spec.rb
24
+ Manifest
data/README ADDED
File without changes
@@ -0,0 +1,9 @@
1
+ require 'echoe'
2
+
3
+ Echoe.new("whereistand") do |p|
4
+ p.author = "whereIstand"
5
+ p.summary = "whereIstand Ruby SDK"
6
+ p.url = "http://github.com/whereIstand/ruby-sdk"
7
+ p.runtime_dependencies = ["yajl-ruby"]
8
+ p.development_dependencies = ["rake", "rspec"]
9
+ end
@@ -0,0 +1,13 @@
1
+ class WIS::Client::Access
2
+
3
+ def self.account_search(string)
4
+ # invoke call to http://api.whereistand.com/account/search?q=blah
5
+ value = "{\"Accounts\":[{\"ID\":380,\"Name\":\"BillClinton\",\"Description\":\"Bill Clinton\"},{\"ID\":120,\"Name\":\"HillaryClinton\",\"Description\":\"Hillary Rodham Clinton\"},{\"ID\":3340,\"Name\":\"ChelseaClinton\",\"Description\":\"Chelsea Clinton\"}],\"Hits\":3}"
6
+ WIS::DOM::AccountResults.adapt_json(Yajl::Parser.parse(value))
7
+ end
8
+
9
+ def self.account_issues_search(account, string)
10
+ value = "{\"Account\":{\"ID\":1,\"Name\":\"BillClinton\",\"Description\":\"William Jefferson Clinton\"},\"Issues\":[{\"Issue\":{\"ID\":1,\"Description\":\"Is global warming cool?\"},\"Unknown\":null,\"Unverified\":null,\"Approved\":{\"Account\":{\"ID\":1,\"Name\":\"BillClinton\",\"Description\":\"William Jefferson Clinton\"},\"Issue\":{\"ID\":1,\"Description\":\"Is global warming cool?\"}}},{\"Issue\":{\"ID\":2,\"Description\":\"Is global warming awesome?\"},\"Unknown\":{\"Account\":null,\"Issue\":{\"ID\":2,\"Description\":\"Is global warming awesome?\"}},\"Unverified\":null,\"Approved\":null},{\"Issue\":{\"ID\":3,\"Description\":\"Is global warming raspy?\"},\"Unknown\":{\"Account\":null,\"Issue\":{\"ID\":3,\"Description\":\"Is global warming raspy?\"}},\"Unverified\":null,\"Approved\":null}],\"Hits\":3}"
11
+ WIS::DOM::AccountIssues.adapt_json(Yajl::Parser.parse(value))
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ class WIS::DOM::Account
2
+ attr_reader :id, :name;
3
+ attr_accessor :description;
4
+
5
+ def initialize(id, name, description)
6
+ @id = id;
7
+ @name = name;
8
+ @description = description;
9
+ end
10
+ end
@@ -0,0 +1,44 @@
1
+ class WIS::DOM::AccountIssues < WIS::DOM::Results
2
+ attr_reader :account, :issues
3
+
4
+ def initialize(hits, account, issues)
5
+ super(hits)
6
+ @account = account
7
+ @issues = issues
8
+ end
9
+
10
+ def self.adapt_json(data)
11
+ account = WIS::DOM::Account.new(data["Account"]["ID"], data["Account"]["Name"], data["Account"]["Description"])
12
+ issues = []
13
+
14
+ data["Issues"].each do |i|
15
+ issue_result = WIS::DOM::IssueResult.new
16
+ issue_result.issue = WIS::DOM::Issue.new(i["Issue"]["ID"], i["Issue"]["Description"])
17
+
18
+ unless i["Approved"].nil?
19
+ opinion = WIS::DOM::AccountIssues.convert_hash_to_opinion(i["Approved"])
20
+ issue_result.approved = WIS::DOM::ApprovedOpinion.new(opinion.account, opinion.issue)
21
+ end
22
+
23
+ unless i["Unverified"].nil?
24
+ opinion = WIS::DOM::AccountIssues.convert_hash_to_opinion(i["Unverified"])
25
+ issue_result.unverified = WIS::DOM::UnverifiedOpinion.new(opinion.account, opinion.issue)
26
+ end
27
+
28
+ unless i["Unknown"].nil?
29
+ opinion = WIS::DOM::AccountIssues.convert_hash_to_opinion(i["Unknown"])
30
+ issue_result.unknown = WIS::DOM::UnknownOpinion.new(opinion.issue)
31
+ end
32
+
33
+ issues << issue_result
34
+ end
35
+
36
+ WIS::DOM::AccountIssues.new(data["Hits"], account, issues)
37
+ end
38
+
39
+ def self.convert_hash_to_opinion(hash)
40
+ account = WIS::DOM::Account.new(hash["Account"]["ID"], hash["Account"]["Name"], hash["Account"]["Description"]) unless hash["Account"].nil?
41
+ issue = WIS::DOM::Issue.new(hash["Issue"]["ID"], hash["Issue"]["Description"])
42
+ WIS::DOM::Opinion.new(account, issue)
43
+ end
44
+ end
@@ -0,0 +1,17 @@
1
+ class WIS::DOM::AccountResults < WIS::DOM::Results
2
+ attr_reader :accounts
3
+
4
+ def initialize(hits, accounts)
5
+ super(hits)
6
+ @accounts = accounts
7
+ end
8
+
9
+ def self.adapt_json(data)
10
+ accounts = []
11
+ data["Accounts"].each do |a|
12
+ accounts << WIS::DOM::Account.new(a["ID"], a["Name"], a["Description"])
13
+ end
14
+
15
+ WIS::DOM::AccountResults.new(data["Hits"], accounts)
16
+ end
17
+ end
@@ -0,0 +1,2 @@
1
+ class WIS::DOM::ApprovedOpinion < WIS::DOM::EvidencedOpinion
2
+ end
@@ -0,0 +1,2 @@
1
+ class WIS::DOM::EvidencedOpinion < WIS::DOM::Opinion
2
+ end
@@ -0,0 +1,2 @@
1
+ class WIS::DOM::ExpressedOpinion < WIS::DOM::Opinion
2
+ end
@@ -0,0 +1,9 @@
1
+ class WIS::DOM::Issue
2
+ attr_reader :id;
3
+ attr_accessor :description;
4
+
5
+ def initialize(id, description)
6
+ @id = id;
7
+ @description = description;
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ class WIS::DOM::IssueAccounts < WIS::DOM::Results
2
+ attr_reader :accounts
3
+
4
+ def initialize(hits, accounts)
5
+ super(hits)
6
+ @accounts = accounts
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ class WIS::DOM::IssueResult
2
+ attr_accessor :issue, :unknown, :unverified, :approved
3
+
4
+ end
@@ -0,0 +1,8 @@
1
+ class WIS::DOM::IssueResults < WIS::DOM::Results
2
+ attr_reader :issues
3
+
4
+ def initialize(hits, issues)
5
+ super(hits)
6
+ @issues = issues
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ class WIS::DOM::Opinion
2
+ attr_reader :account, :issue
3
+
4
+ def initialize(account, issue)
5
+ @account = account
6
+ @issue = issue
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ class WIS::DOM::Results
2
+ attr_reader :hits
3
+
4
+ def initialize(hits)
5
+ @hits = hits
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class WIS::DOM::UnknownOpinion < WIS::DOM::Opinion
2
+ def initialize(issue)
3
+ @issue = issue
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ class WIS::DOM::UnverifiedOpinion < WIS::DOM::EvidencedOpinion
2
+ end
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'yajl'
4
+
5
+ module WIS; module DOM; end; module Client; end; end
6
+
7
+ $:.unshift(File.dirname(__FILE__))
8
+
9
+ require 'dom/account'
10
+ require 'dom/issue'
11
+ require 'dom/opinion'
12
+ require 'dom/evidenced_opinion'
13
+ require 'dom/approved_opinion'
14
+ require 'dom/expressed_opinion'
15
+ require 'dom/unknown_opinion'
16
+ require 'dom/unverified_opinion'
17
+ require 'dom/results'
18
+ require 'dom/account_issues'
19
+ require 'dom/account_results'
20
+ require 'dom/issue_accounts'
21
+ require 'dom/issue_results'
22
+ require 'dom/issue_result'
23
+
24
+ require 'client/access'
@@ -0,0 +1,20 @@
1
+ require 'lib/rubysdk'
2
+
3
+ describe WIS::Client::Access do
4
+
5
+ it "account search should not fail" do
6
+ WIS::Client::Access.account_search("bill clinton")
7
+ end
8
+
9
+ it "account issues search should not fail" do
10
+ account = WIS::DOM::Account.new(1, "BillClinton", "Bill Clinton")
11
+ WIS::Client::Access.account_issues_search(account, "global warming")
12
+ end
13
+
14
+ it "should do this just for me" do
15
+ Dir["**/*"].select do |d|
16
+ puts d
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,39 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{whereistand}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["whereIstand"]
9
+ s.date = %q{2010-10-28}
10
+ s.description = %q{whereIstand Ruby SDK}
11
+ s.email = %q{}
12
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/client/access.rb", "lib/dom/account.rb", "lib/dom/account_issues.rb", "lib/dom/account_results.rb", "lib/dom/approved_opinion.rb", "lib/dom/evidenced_opinion.rb", "lib/dom/expressed_opinion.rb", "lib/dom/issue.rb", "lib/dom/issue_accounts.rb", "lib/dom/issue_result.rb", "lib/dom/issue_results.rb", "lib/dom/opinion.rb", "lib/dom/results.rb", "lib/dom/unknown_opinion.rb", "lib/dom/unverified_opinion.rb", "lib/rubysdk.rb"]
13
+ s.files = ["CHANGELOG", "Gemfile", "Gemfile.lock", "LICENSE", "README", "Rakefile", "lib/client/access.rb", "lib/dom/account.rb", "lib/dom/account_issues.rb", "lib/dom/account_results.rb", "lib/dom/approved_opinion.rb", "lib/dom/evidenced_opinion.rb", "lib/dom/expressed_opinion.rb", "lib/dom/issue.rb", "lib/dom/issue_accounts.rb", "lib/dom/issue_result.rb", "lib/dom/issue_results.rb", "lib/dom/opinion.rb", "lib/dom/results.rb", "lib/dom/unknown_opinion.rb", "lib/dom/unverified_opinion.rb", "lib/rubysdk.rb", "spec/client_access_spec.rb", "Manifest", "whereistand.gemspec"]
14
+ s.homepage = %q{http://github.com/whereIstand/ruby-sdk}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Whereistand", "--main", "README"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{whereistand}
18
+ s.rubygems_version = %q{1.3.7}
19
+ s.summary = %q{whereIstand Ruby SDK}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<yajl-ruby>, [">= 0"])
27
+ s.add_development_dependency(%q<rake>, [">= 0"])
28
+ s.add_development_dependency(%q<rspec>, [">= 0"])
29
+ else
30
+ s.add_dependency(%q<yajl-ruby>, [">= 0"])
31
+ s.add_dependency(%q<rake>, [">= 0"])
32
+ s.add_dependency(%q<rspec>, [">= 0"])
33
+ end
34
+ else
35
+ s.add_dependency(%q<yajl-ruby>, [">= 0"])
36
+ s.add_dependency(%q<rake>, [">= 0"])
37
+ s.add_dependency(%q<rspec>, [">= 0"])
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: whereistand
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - whereIstand
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-28 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: yajl-ruby
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: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: rake
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
63
+ description: whereIstand Ruby SDK
64
+ email: ""
65
+ executables: []
66
+
67
+ extensions: []
68
+
69
+ extra_rdoc_files:
70
+ - CHANGELOG
71
+ - LICENSE
72
+ - README
73
+ - lib/client/access.rb
74
+ - lib/dom/account.rb
75
+ - lib/dom/account_issues.rb
76
+ - lib/dom/account_results.rb
77
+ - lib/dom/approved_opinion.rb
78
+ - lib/dom/evidenced_opinion.rb
79
+ - lib/dom/expressed_opinion.rb
80
+ - lib/dom/issue.rb
81
+ - lib/dom/issue_accounts.rb
82
+ - lib/dom/issue_result.rb
83
+ - lib/dom/issue_results.rb
84
+ - lib/dom/opinion.rb
85
+ - lib/dom/results.rb
86
+ - lib/dom/unknown_opinion.rb
87
+ - lib/dom/unverified_opinion.rb
88
+ - lib/rubysdk.rb
89
+ files:
90
+ - CHANGELOG
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - LICENSE
94
+ - README
95
+ - Rakefile
96
+ - lib/client/access.rb
97
+ - lib/dom/account.rb
98
+ - lib/dom/account_issues.rb
99
+ - lib/dom/account_results.rb
100
+ - lib/dom/approved_opinion.rb
101
+ - lib/dom/evidenced_opinion.rb
102
+ - lib/dom/expressed_opinion.rb
103
+ - lib/dom/issue.rb
104
+ - lib/dom/issue_accounts.rb
105
+ - lib/dom/issue_result.rb
106
+ - lib/dom/issue_results.rb
107
+ - lib/dom/opinion.rb
108
+ - lib/dom/results.rb
109
+ - lib/dom/unknown_opinion.rb
110
+ - lib/dom/unverified_opinion.rb
111
+ - lib/rubysdk.rb
112
+ - spec/client_access_spec.rb
113
+ - Manifest
114
+ - whereistand.gemspec
115
+ has_rdoc: true
116
+ homepage: http://github.com/whereIstand/ruby-sdk
117
+ licenses: []
118
+
119
+ post_install_message:
120
+ rdoc_options:
121
+ - --line-numbers
122
+ - --inline-source
123
+ - --title
124
+ - Whereistand
125
+ - --main
126
+ - README
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ hash: 3
135
+ segments:
136
+ - 0
137
+ version: "0"
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ hash: 11
144
+ segments:
145
+ - 1
146
+ - 2
147
+ version: "1.2"
148
+ requirements: []
149
+
150
+ rubyforge_project: whereistand
151
+ rubygems_version: 1.3.7
152
+ signing_key:
153
+ specification_version: 3
154
+ summary: whereIstand Ruby SDK
155
+ test_files: []
156
+