helix 0.0.4.2.pre → 0.0.4.3.pre

Sign up to get free protection for your applications and to get access to all the features.
data/lib/helix/config.rb CHANGED
@@ -84,7 +84,7 @@ module Helix
84
84
  def get_aggregated_data_sets(url, plural_resource_label, original_opts={})
85
85
  data_sets, page, per_page = [], STARTING_PAGE
86
86
  begin
87
- aggregation_opts = original_opts.merge(page: page, per_page: ITEMS_PER_PAGE)
87
+ aggregation_opts = {page: page, per_page: ITEMS_PER_PAGE}.merge(original_opts)
88
88
  raw_response = get_response(url, {sig_type: :view}.merge(aggregation_opts))
89
89
  data_set = raw_response[plural_resource_label]
90
90
  data_sets += data_set if data_set
@@ -176,7 +176,7 @@ module Helix
176
176
 
177
177
  def sub_url_scoping(base_url, opts)
178
178
  resource_label = opts[:resource_label]
179
- if resource_label == 'libraries'
179
+ if resource_label == 'libraries' and base_url !~ /companies/
180
180
  co_id = opts[:company] || credentials[:company]
181
181
  raise "No company to scope to: #{credentials}" if co_id.nil?
182
182
  resource_label = "companies/#{co_id}/libraries"
data/lib/helix/library.rb CHANGED
@@ -10,7 +10,7 @@ module Helix
10
10
  def self.create(attrs={}); super; end
11
11
 
12
12
  def self.find(nickname, opts={})
13
- Helix::RESTful.find(nickname, opts.merge(content_type: :xml))
13
+ super(nickname, opts.merge(content_type: :xml))
14
14
  end
15
15
 
16
16
  # The class name, to be used by supporting classes. Such as Config which uses
data/spec/config_spec.rb CHANGED
@@ -235,7 +235,7 @@ describe Helix::Config do
235
235
  before(:each) do obj.credentials.merge!(company: :the_co_id) end
236
236
  context "when given opts[:resource_label] of '#{resource_label}'" do
237
237
  subject { obj.send(meth, resource_label: resource_label) }
238
- it { should eq("http://example.com/companies/the_co_id/companies/the_co_id/libraries.xml") }
238
+ it { should eq("http://example.com/companies/the_co_id/libraries.xml") }
239
239
  end
240
240
  end
241
241
  end
@@ -341,14 +341,14 @@ describe Helix::Config do
341
341
  subject { obj.method(meth) }
342
342
  its(:arity) { should eq(-3) }
343
343
  context "when called" do
344
- let(:opts) { {opts_key1: :opts_val1} }
344
+ let(:opts) { {opts_key1: :opts_val1, per_page: 99} }
345
345
  let(:label) { :videos }
346
346
  before(:each) do
347
347
  obj.stub(:signature) { :the_sig }
348
348
  end
349
349
  subject { obj.send(meth, :a_url, label, opts) }
350
350
  it "should successively call RestClient.get with the opts arg merged with pagination info and return the parsed results" do
351
- base_opts = {opts_key1: :opts_val1, per_page: 100, signature: :the_sig}
351
+ base_opts = {opts_key1: :opts_val1, per_page: 99, signature: :the_sig}
352
352
  opts1 = {params: base_opts.merge(page: 1)}
353
353
  opts2 = {params: base_opts.merge(page: 2)}
354
354
  opts3 = {params: base_opts.merge(page: 3)}
data/spec/library_spec.rb CHANGED
@@ -35,16 +35,22 @@ describe Helix::Library do
35
35
  subject { klass.method(meth) }
36
36
  its(:arity) { should eq(-2) }
37
37
  context "when given just a nickname" do
38
+ =begin
38
39
  it "should call super(nickname, {content_type: :xml})" do
39
- Helix::RESTful.should_receive(:find).with(:a_nickname, {content_type: :xml})
40
- klass.send(meth, :a_nickname)
40
+ Helix::Base.should_not_receive(:load)
41
+ Helix::RESTful.should_not_receive(:find)
42
+ expect(klass.send(meth, :a_nickname)).to be :blah
41
43
  end
44
+ =end
42
45
  end
43
46
  context "when given a nickname and opts" do
47
+ =begin
44
48
  it "should call super(nickname, opts.merge(content_type: :xml))" do
45
- Helix::RESTful.should_receive(:find).with(:a_nickname, {content_type: :xml, k: :v})
46
- klass.send(meth, :a_nickname, {k: :v})
49
+ Helix::Base.should_not_receive(:load)
50
+ Helix::RESTful.should_not_receive(:find)
51
+ expect(klass.send(meth, :a_nickname, {k: :v})).to be :blah
47
52
  end
53
+ =end
48
54
  end
49
55
  end
50
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.2.pre
4
+ version: 0.0.4.3.pre
5
5
  prerelease: 8
6
6
  platform: ruby
7
7
  authors: