guidestar 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,8 @@ module Guidestar
15
15
 
16
16
  attr_reader :proxy
17
17
 
18
+ attr_reader :options
19
+
18
20
  # Public: Sets up the core Client object that can be reused throughout
19
21
  # the request.
20
22
  def initialize(options={})
@@ -23,7 +25,7 @@ module Guidestar
23
25
  @username = options.delete(:username) || Guidestar.username
24
26
  @password = options.delete(:password) || Guidestar.password
25
27
  @options = options.reverse_merge!(:version => 1.0,
26
- :limit => 25,
28
+ :page_size => 25,
27
29
  :page => 1 )
28
30
  end
29
31
 
@@ -5,7 +5,7 @@ module Guidestar
5
5
  extend Forwardable
6
6
 
7
7
  def_delegators :organizations, :size, :length, :last
8
- def_delegators :data, :xml, :total_count, :search_time
8
+ def_delegators :data, :xml, :total_count, :search_time, :total_pages
9
9
 
10
10
  def initialize(path, client)
11
11
  @path = path
@@ -46,6 +46,7 @@ module Guidestar
46
46
  raw_response = @client.get_raw(@path, @options)
47
47
  @data[:xml] = ::MultiXml.parse(raw_response.body.string)['root']
48
48
  @data[:total_count] = @data[:xml]['totalResults'].to_i
49
+ @data[:total_pages] = (@data[:total_count].to_f / @client.options[:page_size]).ceil
49
50
  @data[:search_time] = @data[:xml]['searchTime'].to_f
50
51
 
51
52
  @options = {}
@@ -71,8 +72,7 @@ module Guidestar
71
72
  org[:tax_deductible] = org[:deductibility] == 'Contributions are deductible, as provided by law'
72
73
  org[:result_position] = org[:result_position].to_i
73
74
 
74
- ein = org[:ein]
75
- def ein.to_i; self.gsub('-','').to_i; end
75
+ org[:ein] = EIN.new org[:ein]
76
76
 
77
77
  @organizations << org
78
78
  end
@@ -105,6 +105,13 @@ module Guidestar
105
105
  @organizations = nil
106
106
  self
107
107
  end
108
+
109
+ class EIN < ::String
110
+ def to_i
111
+ self.to_s.gsub('-','').to_i
112
+ end
113
+ end
114
+
108
115
  end
109
116
  end
110
117
 
@@ -1,3 +1,3 @@
1
1
  module Guidestar
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guidestar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-05 00:00:00.000000000 Z
12
+ date: 2013-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday