Bizo 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/bizo.rb +1 -0
  2. data/lib/bizo/client.rb +25 -2
  3. metadata +23 -6
@@ -1,4 +1,5 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
+ require 'rubygems'
2
3
  require 'bizo/base'
3
4
  require 'bizo/client'
4
5
 
@@ -20,10 +20,33 @@ module Bizo
20
20
  request :get, ACCOUNT_PATH
21
21
  end
22
22
 
23
- def taxonomy
24
- request :get, TAXONOMY_PATH
23
+ def taxonomy(opts = {})
24
+ taxonomy = request :get, TAXONOMY_PATH
25
+ bizographics = taxonomy["taxonomy"]["bizographics"]
26
+
27
+ unless opts[:exclude].nil? || opts[:exclude].empty?
28
+ bizographics = bizographics.inject({}) do |filtered, pair|
29
+ category, segments = pair
30
+ filtered[category] = segments unless opts[:exclude].include?(category.to_sym)
31
+ filtered
32
+ end
33
+ end
34
+
35
+ if opts[:top_level] == true
36
+ bizographics = bizographics.inject({}) do |filtered, pair|
37
+ category, segments = pair
38
+ segments.each do |segment|
39
+ filtered[category] ||= []
40
+ filtered[category] << segment if segment["parent_code"].nil?
41
+ end
42
+ filtered
43
+ end
44
+ end
45
+
46
+ bizographics
25
47
  end
26
48
 
49
+
27
50
  private
28
51
  TAXONOMY_PATH = "/v1/taxonomy.json"
29
52
  ACCOUNT_PATH = "/v1/account.json"
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Bizo
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.2
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
6
11
  platform: ruby
7
12
  authors:
8
13
  - Joshua Carver
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-02-22 00:00:00 -08:00
18
+ date: 2011-03-25 00:00:00 -07:00
14
19
  default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
@@ -21,6 +26,9 @@ dependencies:
21
26
  requirements:
22
27
  - - ">="
23
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
24
32
  version: "0"
25
33
  type: :runtime
26
34
  version_requirements: *id001
@@ -32,6 +40,9 @@ dependencies:
32
40
  requirements:
33
41
  - - ">="
34
42
  - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
35
46
  version: "0"
36
47
  type: :runtime
37
48
  version_requirements: *id002
@@ -44,10 +55,10 @@ extensions: []
44
55
  extra_rdoc_files: []
45
56
 
46
57
  files:
47
- - lib/bizo.rb
48
58
  - lib/bizo/base.rb
49
59
  - lib/bizo/client.rb
50
- has_rdoc: false
60
+ - lib/bizo.rb
61
+ has_rdoc: true
51
62
  homepage:
52
63
  licenses: []
53
64
 
@@ -61,17 +72,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
72
  requirements:
62
73
  - - ">="
63
74
  - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
64
78
  version: "0"
65
79
  required_rubygems_version: !ruby/object:Gem::Requirement
66
80
  none: false
67
81
  requirements:
68
82
  - - ">="
69
83
  - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
70
87
  version: "0"
71
88
  requirements: []
72
89
 
73
90
  rubyforge_project:
74
- rubygems_version: 1.5.2
91
+ rubygems_version: 1.3.7
75
92
  signing_key:
76
93
  specification_version: 3
77
94
  summary: A simple wrapper around the Bizo API