pillboxr 0.6.1 → 0.7.5

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.
data/Gemfile CHANGED
@@ -1,11 +1,10 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'activeresource', '~> 3.2.0'
4
3
  gem 'httparty'
5
4
 
6
5
  group :development do
7
- gem 'guard'
8
- gem 'guard-minitest'
9
6
  gem 'vcr'
10
7
  gem 'webmock'
8
+ gem 'yard'
9
+ gem 'redcarpet'
11
10
  end
@@ -1,52 +1,26 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activemodel (3.2.6)
5
- activesupport (= 3.2.6)
6
- builder (~> 3.0.0)
7
- activeresource (3.2.6)
8
- activemodel (= 3.2.6)
9
- activesupport (= 3.2.6)
10
- activesupport (3.2.6)
11
- i18n (~> 0.6)
12
- multi_json (~> 1.0)
13
4
  addressable (2.2.8)
14
- builder (3.0.0)
15
5
  crack (0.3.1)
16
- ffi (1.1.2)
17
- guard (1.2.3)
18
- listen (>= 0.4.2)
19
- thor (>= 0.14.6)
20
- guard-minitest (0.5.0)
21
- guard (>= 0.4)
22
6
  httparty (0.8.3)
23
7
  multi_json (~> 1.0)
24
8
  multi_xml
25
- i18n (0.6.0)
26
- listen (0.4.7)
27
- rb-fchange (~> 0.0.5)
28
- rb-fsevent (~> 0.9.1)
29
- rb-inotify (~> 0.8.8)
30
9
  multi_json (1.3.6)
31
10
  multi_xml (0.5.1)
32
- rb-fchange (0.0.5)
33
- ffi
34
- rb-fsevent (0.9.1)
35
- rb-inotify (0.8.8)
36
- ffi (>= 0.5.0)
37
- thor (0.15.4)
11
+ redcarpet (2.1.1)
38
12
  vcr (2.2.4)
39
13
  webmock (1.8.8)
40
14
  addressable (~> 2.2.8)
41
15
  crack (>= 0.1.7)
16
+ yard (0.8.2.1)
42
17
 
43
18
  PLATFORMS
44
19
  ruby
45
20
 
46
21
  DEPENDENCIES
47
- activeresource (~> 3.2.0)
48
- guard
49
- guard-minitest
50
22
  httparty
23
+ redcarpet
51
24
  vcr
52
25
  webmock
26
+ yard
data/README.md CHANGED
@@ -4,7 +4,7 @@ Pillboxr is a Ruby wrapper for the National Library of Medicine Pillbox API Serv
4
4
 
5
5
  The pillbox API provides information from the FDA about various prescription medications.
6
6
 
7
- The current version of this library has two forms. The first (preferred) version does not depend on any gems except for `httparty`. The second version depends upon `active_resource`. This version of Pillboxr inherits from ActiveResource to perform its XML wrapping so ActiveResource 3.2.6 is a requirement for using the wrapper. This version will is deprecated and will be removed in the future. It is not included in the installed gem version, but the code is available in this repository mostly for historical interest.
7
+ Previous versions of this library required ActiveResource. This is no longer the case.
8
8
 
9
9
  *Note:* This library is designed for use with Ruby 1.9.3 and above, and will not work with earlier versions of Ruby.
10
10
 
@@ -51,7 +51,7 @@ require 'pillboxr'
51
51
 
52
52
  result = Pillboxr.with({:color => :blue}) do |r|
53
53
  r.pages.each do |page|
54
- page.get unless page.retrieved?
54
+ page.get # won't retrieve a page that is already retrieved.
55
55
  end
56
56
  end
57
57
 
@@ -68,7 +68,7 @@ require 'pillboxr'
68
68
 
69
69
  result = Pillboxr.color(:blue).all do |r|
70
70
  r.pages.each do |page|
71
- page.get unless page.retrieved?
71
+ page.get # won't retrieve a page that is already retrieved.
72
72
  end
73
73
  end
74
74
 
@@ -80,6 +80,8 @@ all_blue_pills.flatten! # all_blue_pills is now an array of all 2059 blue pills.
80
80
 
81
81
  You can run the tests by typing `rake` in the library directory. You may have to install some development gems prior to running the tests by running `bundle install` in the library directory.
82
82
 
83
+ You can activate a console session with the pillboxr library already loaded by typing `rake console` in the library directory.
84
+
83
85
  ***
84
86
 
85
87
  The hash passed to the `with` method may include any of the following parameters:
@@ -103,7 +105,7 @@ Please see specific files or the document directory for specific usage examples.
103
105
 
104
106
  ## KNOWN BUGS
105
107
 
106
- * The library allows you to request the same page repeatedly resulting in duplicate data.
108
+ * Test coverage is not complete.
107
109
 
108
110
  * Please note that some XML in the Pillbox API is unescaped.
109
111
 
data/Rakefile CHANGED
@@ -16,13 +16,6 @@ Rake::TestTask.new(:standalone_test) do |test|
16
16
  test.verbose = true
17
17
  end
18
18
 
19
- Rake::TestTask.new(:activeresource_test) do |test|
20
- test.libs = []
21
- test.libs << 'lib/active_resource' << 'test/pillboxr_activeresource'
22
- test.pattern = 'test/pillboxr_activeresource/**/*_test.rb'
23
- test.verbose = true
24
- end
25
-
26
19
  task :console do
27
20
  if Kernel.const_defined?(:Pry)
28
21
  Pry.start
@@ -33,6 +26,4 @@ end
33
26
 
34
27
  task :c => :console
35
28
 
36
- task :all => [:standalone_test, :activeresource_test]
37
-
38
29
  task :default => :standalone_test
@@ -8,10 +8,9 @@ require_relative 'pillboxr/request'
8
8
 
9
9
  module Pillboxr
10
10
 
11
- def complete(params = @params, &block)
12
- return Result.new(Request.new(params).perform, &block)
13
- end
14
-
11
+ # Search API for pages of pills. Also accepts a block that yields pages for iterating through.
12
+ # @param [Hash] search parameters, see {Pillboxr::Attributes} for accepted parameters.
13
+ # @return [Result] a {Pillboxr::Result} object that has pages of data that can be iterated through.
15
14
  def with(query_hash, &block)
16
15
  @params ||= Params.new(self)
17
16
 
@@ -45,6 +44,10 @@ module Pillboxr
45
44
  end
46
45
  end
47
46
 
47
+ def complete(params = @params, &block) # :nodoc:
48
+ return Result.new(Request.new(params).perform, &block)
49
+ end
50
+
48
51
  private
49
52
 
50
53
  def symbol_to_instance(symbol, value)
@@ -4,12 +4,13 @@ require 'erb'
4
4
 
5
5
  module Pillboxr
6
6
  module Attributes
7
- def attributes
7
+ def attributes # :nodoc:
8
8
  { :color => :splcolor,
9
9
  :shape => :splshape,
10
10
  :product_code => :product_code,
11
11
  :schedule => :dea_schedule_code,
12
12
  :ingredients => :ingredients,
13
+ :ingredients => :ingredient,
13
14
  :imprint => :splimprint,
14
15
  :id => :spl_id,
15
16
  :ndc9 => :ndc9,
@@ -26,7 +27,7 @@ module Pillboxr
26
27
  :lower_limit => :lower_limit }
27
28
  end
28
29
 
29
- def api_attributes
30
+ def api_attributes # :nodoc:
30
31
  attributes.invert
31
32
  end
32
33
 
@@ -48,7 +49,7 @@ module Pillboxr
48
49
  class Color
49
50
  attr_accessor :color
50
51
 
51
- def initialize(color_arg)
52
+ def initialize(color_arg) # :nodoc:
52
53
  # puts "argument to method = #{color_arg}"
53
54
  @color = case color_arg
54
55
  when NilClass; raise ColorError
@@ -60,7 +61,7 @@ module Pillboxr
60
61
  return self
61
62
  end
62
63
 
63
- def to_param
64
+ def to_param # :nodoc:
64
65
  "&color=" + String(@color)
65
66
  end
66
67
  end
@@ -68,7 +69,7 @@ module Pillboxr
68
69
  class Shape
69
70
  attr_accessor :shape
70
71
 
71
- def initialize(shape_arg)
72
+ def initialize(shape_arg) # :nodoc:
72
73
  # puts "argument to method = #{shape_arg}"
73
74
  @shape = case shape_arg
74
75
  when NilClass; raise ShapeError
@@ -81,7 +82,7 @@ module Pillboxr
81
82
  return self
82
83
  end
83
84
 
84
- def to_param
85
+ def to_param # :nodoc:
85
86
  "&shape=" + String(@shape)
86
87
  end
87
88
  end
@@ -89,7 +90,7 @@ module Pillboxr
89
90
  class Productcode
90
91
  attr_accessor :product_code
91
92
 
92
- def initialize(product_code_arg)
93
+ def initialize(product_code_arg) # :nodoc:
93
94
  # puts "argument to method = #{product_code_arg}"
94
95
  @code = case product_code_arg
95
96
  when NilClass; raise ProductcodeError
@@ -101,7 +102,7 @@ module Pillboxr
101
102
  return self
102
103
  end
103
104
 
104
- def to_param
105
+ def to_param # :nodoc:
105
106
  "&prodcode=" + String(@code)
106
107
  end
107
108
  end
@@ -109,7 +110,7 @@ module Pillboxr
109
110
  class Schedule
110
111
  attr_accessor :schedule
111
112
 
112
- def initialize(schedule_code)
113
+ def initialize(schedule_code) # :nodoc:
113
114
  # puts "argument to method = #{schedule_code}"
114
115
  @schedule = case schedule_code
115
116
  when NilClass; raise ScheduleError
@@ -121,7 +122,7 @@ module Pillboxr
121
122
  return self
122
123
  end
123
124
 
124
- def to_param
125
+ def to_param # :nodoc:
125
126
  "&dea=" + String(@schedule)
126
127
  end
127
128
  end
@@ -129,7 +130,7 @@ module Pillboxr
129
130
  class Ingredients
130
131
  attr_accessor :ingredients
131
132
 
132
- def initialize(ingredient_arg)
133
+ def initialize(ingredient_arg) # :nodoc:
133
134
  # puts "argument to method = #{ingredient_arg}"
134
135
  @ingredients = case ingredient_arg
135
136
  when NilClass; raise IngredientError
@@ -141,7 +142,7 @@ module Pillboxr
141
142
  return self
142
143
  end
143
144
 
144
- def to_param
145
+ def to_param # :nodoc:
145
146
  "&ingredient=" + String(@ingredients)
146
147
  end
147
148
  end
@@ -170,7 +171,7 @@ module Pillboxr
170
171
  class Size
171
172
  attr_accessor :size
172
173
 
173
- def initialize(size_arg)
174
+ def initialize(size_arg) # :nodoc:
174
175
  @size = case size_arg
175
176
  when NilClass; raise SizeError
176
177
  when Integer; size_arg
@@ -182,7 +183,7 @@ module Pillboxr
182
183
  return self
183
184
  end
184
185
 
185
- def to_param
186
+ def to_param # :nodoc:
186
187
  "&size=" + String(@size)
187
188
  end
188
189
 
@@ -192,7 +193,7 @@ module Pillboxr
192
193
  class Score
193
194
  attr_accessor :score
194
195
 
195
- def initialize(score_arg)
196
+ def initialize(score_arg) # :nodoc:
196
197
  # puts "argument to method = #{score_arg}"
197
198
  @score = case score_arg
198
199
  when NilClass; raise ScoreError
@@ -205,7 +206,7 @@ module Pillboxr
205
206
  return self
206
207
  end
207
208
 
208
- def to_param
209
+ def to_param # :nodoc:
209
210
  "&score=" + String(@score)
210
211
  end
211
212
  end
@@ -213,7 +214,7 @@ module Pillboxr
213
214
  class Image
214
215
  attr_accessor :image
215
216
 
216
- def initialize(image_arg)
217
+ def initialize(image_arg) # :nodoc:
217
218
  # puts "argument to method = #{image_arg}"
218
219
  @image = case image_arg
219
220
  when NilClass; raise ImageError
@@ -225,7 +226,7 @@ module Pillboxr
225
226
  return self
226
227
  end
227
228
 
228
- def to_param
229
+ def to_param # :nodoc:
229
230
  "&has_image=" + String(@image)
230
231
  end
231
232
  end
@@ -233,7 +234,7 @@ module Pillboxr
233
234
  class Author
234
235
  attr_accessor :author
235
236
 
236
- def initialize(author_arg)
237
+ def initialize(author_arg) # :nodoc:
237
238
  @author = case author_arg
238
239
  when String; author_arg
239
240
  when Array; raise ArgumentError, "Author can only take a single string."
@@ -242,7 +243,7 @@ module Pillboxr
242
243
  return self
243
244
  end
244
245
 
245
- def to_param
246
+ def to_param # :nodoc:
246
247
  "&author=" + ERB::Util.url_encode(@author)
247
248
  end
248
249
  end
@@ -3,7 +3,7 @@ require_relative 'attributes'
3
3
 
4
4
  module Pillboxr
5
5
  module Extensions
6
- def to_constant
6
+ def to_constant # :nodoc:
7
7
  raise TypeError unless self.kind_of?(String)
8
8
  Array(self).inject(Pillboxr::Attributes) { |s,e| s.const_get(e.to_sym) }
9
9
  end
@@ -11,7 +11,7 @@ module Pillboxr
11
11
  @data = Array.new(size, &block)
12
12
  end
13
13
 
14
- def inspect
14
+ def inspect # :nodoc:
15
15
  string = "#<Pillboxr::Result::Pages:#{object_id} ["
16
16
  @data.each do |page|
17
17
  string << String(page)
@@ -86,7 +86,7 @@ module Pillboxr
86
86
  return page
87
87
  end
88
88
 
89
- def current_index
89
+ def current_index # :nodoc:
90
90
  @data.index { |page| page.current }
91
91
  end
92
92
 
@@ -107,7 +107,9 @@ module Pillboxr
107
107
  end
108
108
 
109
109
  def get
110
- unless self.retrieved
110
+ if self.retrieved
111
+ puts "You have already retrieved that page."
112
+ else
111
113
  self.pills = Result.subsequent(Request.new(self.params).perform)
112
114
  puts "#{self.pills.size} records retrieved."
113
115
  self.retrieved = true
@@ -12,7 +12,7 @@ module Pillboxr
12
12
  end
13
13
 
14
14
  def all(&block)
15
- @module_name.send(:complete, &block)
15
+ @module_name.send(:complete, self, &block)
16
16
  end
17
17
 
18
18
  def limit
@@ -24,12 +24,12 @@ module Pillboxr
24
24
  end
25
25
  end
26
26
 
27
- def respond_to_missing(method_name, include_private = false) # :nodoc:
28
- @module_name.send(:respond_to_missing, method_name, include_private)
27
+ def respond_to_missing?(method_name, include_private = false) # :nodoc:
28
+ @module_name.send(:respond_to?, method_name)
29
29
  end
30
30
 
31
- def method_missing(method_name, *args)
32
- puts "Params method missing called with #{method_name}."
31
+ def method_missing(method_name, *args) # :nodoc:
32
+ # puts "Params method missing called with #{method_name}."
33
33
  @module_name.send(:method_missing, method_name, *args)
34
34
  end
35
35
  end
@@ -8,23 +8,23 @@ module Pillboxr
8
8
  format :xml
9
9
  base_uri BASE_URI
10
10
  parser(Class.new(HTTParty::Parser) do
11
- def parse
12
- begin
13
- body.gsub!(/^<disclaimer>.+<\/disclaimer>/, "")
14
- body.gsub!(/\s\&\s/, ' and ')
15
- super
16
- rescue MultiXml::ParseError => e
17
- if e.message == NO_RECORDS_ERROR_MESSAGE
18
- result = {'Pills' => {'pill' => [], 'record_count' => 0 }}
19
- return result
20
- elsif e.message == API_KEY_ERROR_MESSAGE
21
- raise "Invalid api_key.yml. Check format and try again."
22
- else
23
- raise
24
- end
11
+ def parse
12
+ begin
13
+ body.gsub!(/^<disclaimer>.+<\/disclaimer>/, "")
14
+ body.gsub!(/\s\&\s/, ' and ')
15
+ super
16
+ rescue MultiXml::ParseError => e
17
+ if e.message == NO_RECORDS_ERROR_MESSAGE
18
+ result = {'Pills' => {'pill' => [], 'record_count' => 0 }}
19
+ return result
20
+ elsif e.message == API_KEY_ERROR_MESSAGE
21
+ raise "Invalid api_key.yml. Check format and try again."
22
+ else
23
+ raise
25
24
  end
26
25
  end
27
- end)
26
+ end
27
+ end)
28
28
 
29
29
  attr_reader :full_path, :params, :api_response
30
30
 
@@ -1,8 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module Pillboxr
3
3
  Response = Struct.new(:body, :query) do
4
-
5
-
6
4
  end
7
-
8
5
  end
@@ -38,6 +38,22 @@ module Pillboxr
38
38
  return pills
39
39
  end
40
40
 
41
+ def inspect
42
+ string = "#<Pillboxr::Result:#{object_id} "
43
+ instance_variables.each do |ivar|
44
+ string << String(ivar)
45
+ string << " = "
46
+ string << (String(self.instance_variable_get(ivar)) || "")
47
+ string << ", " unless ivar == instance_variables.last
48
+ end unless instance_variables.empty?
49
+ string << ">"
50
+ return string
51
+ end
52
+
53
+ alias_method :to_s, :inspect
54
+
55
+ private
56
+
41
57
  def initialize_pages_array(api_response, initial_page_number)
42
58
  unless record_count == 0
43
59
  record_count.divmod(RECORDS_PER_PAGE).tap do |ary|
@@ -60,20 +76,5 @@ module Pillboxr
60
76
  end
61
77
  return Pages.new(1) { |i| Page.new(true, true, i, [], api_response.query.params.dup)}
62
78
  end
63
-
64
- def inspect
65
- string = "#<Pillboxr::Result:#{object_id} "
66
- instance_variables.each do |ivar|
67
- string << String(ivar)
68
- string << " = "
69
- string << (String(self.instance_variable_get(ivar)) || "")
70
- string << ", " unless ivar == instance_variables.last
71
- end unless instance_variables.empty?
72
- string << ">"
73
- return string
74
- end
75
-
76
- alias_method :to_s, :inspect
77
- private :initialize_pages_array
78
79
  end
79
80
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module Pillboxr
3
- VERSION = "0.6.1"
3
+ VERSION = "0.7.5"
4
4
  end
@@ -9,22 +9,16 @@ Gem::Specification.new do |s|
9
9
  s.authors = ['Keith Gautreaux', 'David Hale', 'Darius Roberts']
10
10
  s.email = ['keith.gautreaux@gmail.com']
11
11
  s.homepage = "http://rubygems.org/gems/pillboxr"
12
- s.summary = "Access the NLM Pillbox API using ActiveResource."
12
+ s.summary = "Access the NLM Pillbox API using Ruby."
13
13
  s.description = <<-END
14
- Pillboxr is a Ruby wrapper for the National Library of Medicine Pillbox API Service located at http://pillbox.nlm.nih.gov](http://pillbox.nlm.nih.gov).
14
+ Pillboxr is a Ruby wrapper for the National Library of Medicine Pillbox API Service located at http://pillbox.nlm.nih.gov.
15
15
 
16
16
  The pillbox API provides information from the FDA about various prescription medications.
17
17
 
18
- The current version of this library has two forms. The first (preferred) version does not depend on any gems except for `httparty`.
19
- The second version depends upon `active_resource`.
20
- This version of Pillboxr inherits from ActiveResource to perform its XML wrapping so ActiveResource 3.2.6 is a requirement for using the wrapper.
21
-
22
- This deprecated version is not included in the distributed gem but the library code can be found at [https://github.com/kgautreaux/pillboxr](https://github.com/kgautreaux/pillboxr).
23
-
24
18
  *Note:* This library is designed for use with Ruby 1.9.3 and above, and will not work with earlier versions of Ruby.
25
19
  END
26
20
 
27
- s.required_rubygems_version = ">= 1.8.6"
21
+ s.required_rubygems_version = "~> 1.8.6"
28
22
  s.rubyforge_project = "pillboxr"
29
23
 
30
24
  s.add_dependency 'httparty', '~> 0.8.3'
@@ -32,6 +26,8 @@ END
32
26
  s.add_development_dependency "bundler", "~> 1.0.0"
33
27
  s.add_development_dependency 'webmock', '~>1.8.8'
34
28
  s.add_development_dependency 'vcr', '~> 2.2.4'
29
+ s.add_development_dependency 'yard', '~> 0.8.2.1'
30
+ s.add_development_dependency 'redcarpet', '~> 2.1.1'
35
31
 
36
32
  s.files = `git ls-files`.split("\n").delete_if { |fn| fn.match(/active(_|)resource/) }
37
33
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  require_relative 'test_helper'
2
3
 
3
4
  class TestAttributes < MiniTest::Unit::TestCase
@@ -12,4 +13,19 @@ class TestAttributes < MiniTest::Unit::TestCase
12
13
  def test_fetching_an_api_attribute
13
14
  assert_equal(:color, api_attributes.fetch(:splcolor))
14
15
  end
16
+
17
+ def test_to_param
18
+ Pillboxr::Attributes::COLORS.each do |k,v|
19
+ color = Pillboxr::Attributes::Color.new(k)
20
+ assert_equal("&color=#{v}", color.to_param)
21
+ end
22
+ Pillboxr::Attributes::SHAPES.each do |k,v|
23
+ shape = Pillboxr::Attributes::Shape.new(k)
24
+ assert_equal("&shape=#{v}", shape.to_param)
25
+ end
26
+ Pillboxr::Attributes::DEA_CODES.each do |k,v|
27
+ code = Pillboxr::Attributes::Schedule.new(k)
28
+ assert_equal("&dea=#{v}", code.to_param)
29
+ end
30
+ end
15
31
  end
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  require_relative 'test_helper'
2
3
 
3
4
  class TestParams < MiniTest::Unit::TestCase
@@ -22,7 +23,26 @@ class TestParams < MiniTest::Unit::TestCase
22
23
  assert_equal(300, @params.limit)
23
24
  end
24
25
 
25
- def test_method_missing
26
+ def test_all_method
27
+ pillboxr = MiniTest::Mock.new
28
+ result = MiniTest::Mock.new
29
+ p = Pillboxr::Params.new(pillboxr)
30
+ pillboxr.expect(:send, result, [:complete, @params])
31
+ p.all
32
+ pillboxr.verify
33
+ end
34
+
35
+ def test_respond_to_missing
36
+ Pillboxr.attributes.each do |k,v|
37
+ assert_respond_to(@params, k)
38
+ assert_respond_to(@params, v)
39
+ end
40
+ deny @params.respond_to?(:foo)
41
+ end
26
42
 
43
+ def test_method_missing
44
+ r = @params.color(:blue)
45
+ refute_empty r
46
+ assert_instance_of(Pillboxr::Attributes::Color, r.first)
27
47
  end
28
48
  end
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  require_relative 'test_helper'
2
3
 
3
4
  class TestPill < MiniTest::Unit::TestCase
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  require_relative 'test_helper'
2
3
  require 'vcr'
3
4
 
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require_relative 'test_helper'
3
+ require_relative '../../lib/pillboxr/response'
4
+
5
+ class TestResponse < MiniTest::Unit::TestCase
6
+ def setup
7
+ @response = Pillboxr::Response.new("body", "query")
8
+ end
9
+
10
+ def test_body_retrieval
11
+ assert_equal("body", @response.body)
12
+ end
13
+
14
+ def test_query_string_retrieval
15
+ assert_equal("query", @response.query)
16
+ end
17
+
18
+ def test_passing_a_query_string
19
+ r = Pillboxr::Response.new("body", "foo")
20
+ assert_equal("foo", r.query)
21
+ end
22
+
23
+ def test_passing_a_body
24
+ r = Pillboxr::Response.new("foo", "query")
25
+ assert_equal("foo", r.body)
26
+ end
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pillboxr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-08-24 00:00:00.000000000 Z
14
+ date: 2012-09-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty
@@ -77,26 +77,45 @@ dependencies:
77
77
  - - ~>
78
78
  - !ruby/object:Gem::Version
79
79
  version: 2.2.4
80
+ - !ruby/object:Gem::Dependency
81
+ name: yard
82
+ requirement: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 0.8.2.1
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: 0.8.2.1
96
+ - !ruby/object:Gem::Dependency
97
+ name: redcarpet
98
+ requirement: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 2.1.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ version: 2.1.1
80
112
  description: ! 'Pillboxr is a Ruby wrapper for the National Library of Medicine Pillbox
81
- API Service located at http://pillbox.nlm.nih.gov](http://pillbox.nlm.nih.gov).
113
+ API Service located at http://pillbox.nlm.nih.gov.
82
114
 
83
115
 
84
116
  The pillbox API provides information from the FDA about various prescription medications.
85
117
 
86
118
 
87
- The current version of this library has two forms. The first (preferred) version
88
- does not depend on any gems except for `httparty`.
89
-
90
- The second version depends upon `active_resource`.
91
-
92
- This version of Pillboxr inherits from ActiveResource to perform its XML wrapping
93
- so ActiveResource 3.2.6 is a requirement for using the wrapper.
94
-
95
-
96
- This deprecated version is not included in the distributed gem but the library code
97
- can be found at [https://github.com/kgautreaux/pillboxr](https://github.com/kgautreaux/pillboxr).
98
-
99
-
100
119
  *Note:* This library is designed for use with Ruby 1.9.3 and above, and will not
101
120
  work with earlier versions of Ruby.
102
121
 
@@ -127,6 +146,7 @@ files:
127
146
  - test/pillboxr/params_test.rb
128
147
  - test/pillboxr/pill_test.rb
129
148
  - test/pillboxr/pillboxr_test.rb
149
+ - test/pillboxr/response_test.rb
130
150
  - test/pillboxr/test_helper.rb
131
151
  homepage: http://rubygems.org/gems/pillboxr
132
152
  licenses: []
@@ -143,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
163
  required_rubygems_version: !ruby/object:Gem::Requirement
144
164
  none: false
145
165
  requirements:
146
- - - ! '>='
166
+ - - ~>
147
167
  - !ruby/object:Gem::Version
148
168
  version: 1.8.6
149
169
  requirements: []
@@ -151,6 +171,6 @@ rubyforge_project: pillboxr
151
171
  rubygems_version: 1.8.24
152
172
  signing_key:
153
173
  specification_version: 3
154
- summary: Access the NLM Pillbox API using ActiveResource.
174
+ summary: Access the NLM Pillbox API using Ruby.
155
175
  test_files: []
156
176
  has_rdoc: