gi_cat_driver 0.2.0 → 0.2.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.
data/README.md CHANGED
@@ -43,6 +43,19 @@ Annotated source code documentation is available at http://nsidc.github.com/gi_c
43
43
  Rubydoc API documentation is available at http://rubydoc.info/gems/gi_cat_driver/
44
44
 
45
45
  ## Version History
46
+ * 0.2.1
47
+ * Fixed harvester requests to use Faraday
48
+ * 0.2.0
49
+ * Introduced Faraday gem to replace rest-client and webmock for testing requests
50
+ * Implemented tests for methods that use fixtures to mock response data
51
+ * 0.1.12
52
+ * Fixed typo in check for harvest status
53
+ * 0.1.11
54
+ * Added sleep to harvest method to limit console output
55
+ * 0.1.10
56
+ * Fixed rocco rake task
57
+ * 0.1.9
58
+ * Added rake task to generate rocco docs
46
59
  * 0.1.8
47
60
  * Changed harvest api so the timeout is configurable
48
61
  * 0.1.7
@@ -1,3 +1,3 @@
1
1
  module GiCatDriver
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/gi_cat_driver.rb CHANGED
@@ -126,8 +126,8 @@ module GiCatDriver
126
126
  # Retrive the distributor id given a profile id
127
127
  def get_active_profile_distributor_id(id)
128
128
  active_profile_request = "#{@base_url}/services/conf/brokerConfigurations/#{id}"
129
- response = RestClient.get(active_profile_request, STANDARD_HEADERS)
130
- id = Nokogiri::XML(response).css("component id").text
129
+ response = Faraday.get(active_profile_request, STANDARD_HEADERS)
130
+ id = Nokogiri::XML(response.body).css("component id").text
131
131
  return id
132
132
  end
133
133
 
@@ -135,8 +135,8 @@ module GiCatDriver
135
135
  def get_harvest_resources(profile_id)
136
136
  id = get_active_profile_distributor_id(profile_id)
137
137
  harvest_resource_request = "#{@base_url}/services/conf/brokerConfigurations/#{profile_id}/distributors/#{id}"
138
- response = RestClient.get(harvest_resource_request, STANDARD_HEADERS)
139
- doc = Nokogiri::XML(response)
138
+ response = Faraday.get(harvest_resource_request, STANDARD_HEADERS)
139
+ doc = Nokogiri::XML(response.body)
140
140
  harvestersinfo_array = {}
141
141
  doc.css("component").each do |component|
142
142
  harvestersinfo_array[component.css("id").text.to_sym] = component.css("title").text
@@ -148,7 +148,7 @@ module GiCatDriver
148
148
  def harvest_resource_for_active_configuration(harvesterid, harvestername = "n/a")
149
149
  Faraday.get(
150
150
  "#{@base_url}/services/conf/brokerConfigurations/#{self.get_active_profile_id}/harvesters/#{harvesterid}/start",
151
- STANDARD_HEADERS) do |response, request, result, &block|
151
+ AUTHORIZATION_HEADERS) do |response, request, result, &block|
152
152
  case response.code
153
153
  when 200
154
154
  puts "#{Time.now}: Initiate harvesting GI-Cat resource #{harvestername}. Please wait a couple minutes for the process to complete."
@@ -181,7 +181,7 @@ module GiCatDriver
181
181
  rnum=rand
182
182
  request = @base_url + "/services/conf/giconf/status?id=#{harvesterid}&rand=#{rnum}"
183
183
 
184
- response = Faraday.get request
184
+ response = Faraday.get request, STANDARD_HEADERS
185
185
  responsexml = Nokogiri::XML::Reader(response.body)
186
186
  responsexml.each do |node|
187
187
  if node.name == "status" && !node.inner_xml.empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gi_cat_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: