helix 0.0.2.5.pre → 0.0.2.6.pre

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.
@@ -9,10 +9,10 @@ module Helix
9
9
  #
10
10
  #
11
11
  # @example
12
- # Helix::Album.media_type_sym #=> :album
12
+ # Helix::Album.resource_label_sym #=> :album
13
13
  #
14
14
  # @return [Symbol] Name of the class.
15
- def self.media_type_sym; :album; end
15
+ def self.resource_label_sym; super; end
16
16
 
17
17
  # Currently update is unsupported for album.
18
18
  #
@@ -8,7 +8,7 @@ module Helix
8
8
  class Base
9
9
 
10
10
  unless defined?(self::METHODS_DELEGATED_TO_CLASS)
11
- METHODS_DELEGATED_TO_CLASS = [ :guid_name, :media_type_sym, :plural_media_type ]
11
+ METHODS_DELEGATED_TO_CLASS = [ :guid_name, :resource_label_sym, :plural_resource_label ]
12
12
  end
13
13
 
14
14
  attr_accessor :attributes
@@ -48,11 +48,11 @@ module Helix
48
48
  # @param [Hash] opts a hash of options for parameters passed into the HTTP GET
49
49
  # @return [Array] The array of attributes (for a model) in hash form.
50
50
  def self.get_data_sets(opts)
51
- url = config.build_url(content_type: opts[:content_type] || :xml,
52
- media_type: self.plural_media_type)
51
+ url = config.build_url(content_type: opts[:content_type] || :xml,
52
+ resource_label: self.plural_resource_label)
53
53
  # We allow opts[:sig_type] for internal negative testing only.
54
54
  raw_response = config.get_response(url, {sig_type: :view}.merge(opts))
55
- data_sets = raw_response[plural_media_type]
55
+ data_sets = raw_response[plural_resource_label]
56
56
  end
57
57
 
58
58
  # Creates a string that associates to the class id.
@@ -62,17 +62,17 @@ module Helix
62
62
  #
63
63
  # @return [String] The guid name for a specific class.
64
64
  def self.guid_name
65
- "#{self.media_type_sym}_id"
65
+ "#{self.resource_label_sym}_id"
66
66
  end
67
67
 
68
68
  # Creates a string associated with a class name pluralized
69
69
  #
70
70
  # @example
71
- # Helix::Video.plural_media_type #=> "videos"
71
+ # Helix::Video.plural_resource_label #=> "videos"
72
72
  #
73
73
  # @return [String] The class name pluralized
74
- def self.plural_media_type
75
- "#{self.media_type_sym}s"
74
+ def self.plural_resource_label
75
+ "#{self.resource_label_sym}s"
76
76
  end
77
77
 
78
78
  METHODS_DELEGATED_TO_CLASS.each do |meth|
@@ -111,7 +111,7 @@ module Helix
111
111
  # @return [Base] Returns an instance of the class.
112
112
  def load(opts={})
113
113
  memo_cfg = config
114
- url = memo_cfg.build_url(content_type: :json, guid: self.guid, media_type: plural_media_type)
114
+ url = memo_cfg.build_url(content_type: :json, guid: self.guid, resource_label: plural_resource_label)
115
115
  # We allow opts[:sig_type] for internal negative testing only.
116
116
  raw_attrs = memo_cfg.get_response(url, {sig_type: :view}.merge(opts))
117
117
  @attributes = massage_raw_attrs(raw_attrs)
@@ -170,5 +170,9 @@ module Helix
170
170
  attrs.merge({'custom_fields' => cfs})
171
171
  end
172
172
 
173
+ def self.resource_label_sym
174
+ to_s.split('::').last.singularize.downcase.to_sym
175
+ end
176
+
173
177
  end
174
178
  end
@@ -48,7 +48,7 @@ module Helix
48
48
  # @return [String] The full RESTful URL string object
49
49
  def add_sub_urls(base_url, opts)
50
50
  guid, action, format = [:guid, :action, :formats].map { |sub| opts[sub] }
51
- url = "#{base_url}/#{opts[:media_type]}"
51
+ url = "#{base_url}/#{opts[:resource_label]}"
52
52
  url += "/#{guid}" if guid
53
53
  url += "/formats/#{format}" if format
54
54
  url += "/#{action}" if action
@@ -61,10 +61,10 @@ module Helix
61
61
  # @param [Hash] opts a hash of options for building URL
62
62
  # @return [String] The full RESTful URL string object
63
63
  def build_url(opts={})
64
- opts[:content_type] ||= :xml
65
- opts[:media_type] ||= :videos
66
- base_url = get_base_url(opts)
67
- url = add_sub_urls(base_url, opts)
64
+ opts[:content_type] ||= :xml
65
+ opts[:resource_label] ||= :videos
66
+ base_url = get_base_url(opts)
67
+ url = add_sub_urls(base_url, opts)
68
68
  end
69
69
 
70
70
  def clear_signatures!
@@ -75,13 +75,13 @@ module Helix
75
75
  #
76
76
  # @return [Hash]
77
77
  def url_opts_for(format=nil)
78
- { slice: { action: :slice,
79
- media_type: plural_media_type,
80
- content_type: :xml,
81
- formats: format },
82
- create_many: { action: :create_many,
83
- media_type: plural_media_type,
84
- content_type: :xml }
78
+ { slice: { action: :slice,
79
+ resource_label: plural_resource_label,
80
+ content_type: :xml,
81
+ formats: format },
82
+ create_many: { action: :create_many,
83
+ resource_label: plural_resource_label,
84
+ content_type: :xml }
85
85
  }
86
86
  end
87
87
  end
@@ -9,10 +9,10 @@ module Helix
9
9
  #
10
10
  #
11
11
  # @example
12
- # Helix::Image.media_type_sym #=> :image
12
+ # Helix::Image.resource_label_sym #=> :image
13
13
  #
14
14
  # @return [Symbol] Name of the class.
15
- def self.media_type_sym; :image; end
15
+ def self.resource_label_sym; super; end
16
16
 
17
17
  end
18
18
 
@@ -9,19 +9,19 @@ module Helix
9
9
  #
10
10
  #
11
11
  # @example
12
- # Helix::Library.media_type_sym #=> :library
12
+ # Helix::Library.resource_label_sym #=> :library
13
13
  #
14
14
  # @return [Symbol] Name of the class.
15
- def self.media_type_sym; :library; end
15
+ def self.resource_label_sym; super; end
16
16
 
17
17
  # Creates a string associated with a class name pluralized
18
18
  #
19
19
  # @example
20
- # Helix::Library.plural_media_type #=> "libraries"
20
+ # Helix::Library.plural_resource_label #=> "libraries"
21
21
  #
22
22
  # @return [String] The class name pluralized
23
- def self.plural_media_type
24
- "#{self.media_type_sym.to_s.gsub(/y/, '')}ies"
23
+ def self.plural_resource_label
24
+ "libraries"
25
25
  end
26
26
 
27
27
  def self.known_attributes
@@ -30,4 +30,4 @@ module Helix
30
30
 
31
31
  end
32
32
 
33
- end
33
+ end
@@ -13,11 +13,11 @@ module Helix
13
13
  # @param [Hash] attributes a hash containing the attributes used in the create
14
14
  # @return [Base] An instance of Helix::Base
15
15
  def self.create(attributes={})
16
- url = config.build_url(media_type: plural_media_type,
17
- content_type: :xml)
16
+ url = config.build_url(resource_label: plural_resource_label,
17
+ content_type: :xml)
18
18
  response = RestClient.post(url, attributes.merge(signature: config.signature(:update)))
19
19
  attrs = Hash.from_xml(response)
20
- self.new(attributes: attrs[media_type_sym.to_s], config: config)
20
+ self.new(attributes: attrs[resource_label_sym.to_s], config: config)
21
21
  end
22
22
 
23
23
  # Finds and returns a record in instance form for a class, through
@@ -43,7 +43,7 @@ module Helix
43
43
  #
44
44
  # @return [String] The response from the HTTP DELETE call.
45
45
  def destroy
46
- url = config.build_url(content_type: :xml, guid: guid, media_type: plural_media_type)
46
+ url = config.build_url(content_type: :xml, guid: guid, resource_label: plural_resource_label)
47
47
  RestClient.delete(url, params: {signature: config.signature(:update)})
48
48
  end
49
49
 
@@ -58,10 +58,10 @@ module Helix
58
58
  def update(opts={})
59
59
  RestClient.log = 'helix.log' if opts.delete(:log)
60
60
  memo_cfg = config
61
- url = memo_cfg.build_url(content_type: :xml,
62
- guid: guid,
63
- media_type: plural_media_type)
64
- params = {signature: memo_cfg.signature(:update)}.merge(media_type_sym => opts)
61
+ url = memo_cfg.build_url(content_type: :xml,
62
+ guid: guid,
63
+ resource_label: plural_resource_label)
64
+ params = {signature: memo_cfg.signature(:update)}.merge(resource_label_sym => opts)
65
65
  RestClient.put(url, params)
66
66
  self
67
67
  end
@@ -124,42 +124,42 @@ module Helix
124
124
 
125
125
  private
126
126
 
127
- def self.delivery(media_type, opts)
127
+ def self.delivery(resource_label, opts)
128
128
  memo_cfg = Helix::Config.instance
129
129
  content_type = opts.delete(:content_type)
130
- guid = opts.delete("#{media_type}_id".to_sym)
130
+ guid = opts.delete("#{resource_label}_id".to_sym)
131
131
  url_opts = guid ?
132
- {guid: guid, media_type: "#{media_type}s".to_sym, action: :statistics} :
133
- {media_type: :statistics, action: "#{media_type}_delivery".to_sym}
132
+ {guid: guid, resource_label: "#{resource_label}s".to_sym, action: :statistics} :
133
+ {resource_label: :statistics, action: "#{resource_label}_delivery".to_sym}
134
134
  url_opts.merge!(content_type: content_type) if content_type
135
135
  url = memo_cfg.build_url(url_opts)
136
136
  # We allow opts[:sig_type] for internal negative testing only.
137
137
  memo_cfg.get_response(url, {sig_type: :view}.merge(opts))
138
138
  end
139
139
 
140
- def self.ingest(media_type, opts)
140
+ def self.ingest(resource_label, opts)
141
141
  opts[:action] ||= :breakdown
142
- action_prefix = ingest_action_prefix_for(media_type)
143
- storage(media_type, opts.merge(action: :"#{action_prefix}/#{opts[:action]}"))
142
+ action_prefix = ingest_action_prefix_for(resource_label)
143
+ storage(resource_label, opts.merge(action: :"#{action_prefix}/#{opts[:action]}"))
144
144
  end
145
145
 
146
- def self.storage(media_type, opts)
146
+ def self.storage(resource_label, opts)
147
147
  memo_cfg = Helix::Config.instance
148
148
  content_type = opts.delete(:content_type)
149
- action = opts.delete(:action) || storage_action_for(media_type)
150
- url_opts = {media_type: :statistics, action: action}
149
+ action = opts.delete(:action) || storage_action_for(resource_label)
150
+ url_opts = {resource_label: :statistics, action: action}
151
151
  url_opts.merge!(content_type: content_type) if content_type
152
152
  url = memo_cfg.build_url(url_opts)
153
153
  # We allow opts[:sig_type] for internal negative testing only.
154
154
  memo_cfg.get_response(url, {sig_type: :view}.merge(opts))
155
155
  end
156
156
 
157
- def self.ingest_action_prefix_for(media_type)
158
- STORAGE_ACTION_FOR[media_type].split('/').first
157
+ def self.ingest_action_prefix_for(resource_label)
158
+ STORAGE_ACTION_FOR[resource_label].split('/').first
159
159
  end
160
160
 
161
- def self.storage_action_for(media_type)
162
- STORAGE_ACTION_FOR[media_type].to_sym
161
+ def self.storage_action_for(resource_label)
162
+ STORAGE_ACTION_FOR[resource_label].to_sym
163
163
  end
164
164
 
165
165
  end
@@ -10,9 +10,9 @@ module Helix
10
10
  #
11
11
  #
12
12
  # @example
13
- # Helix::Tag.media_type_sym #=> :tag
13
+ # Helix::Tag.resource_label_sym #=> :tag
14
14
  #
15
15
  # @return [Symbol] Name of the class.
16
- def self.media_type_sym; :tag; end
16
+ def self.resource_label_sym; super; end
17
17
  end
18
- end
18
+ end
@@ -11,9 +11,9 @@ module Helix
11
11
  #
12
12
  #
13
13
  # @example
14
- # Helix::Track.media_type_sym #=> :track
14
+ # Helix::Track.resource_label_sym #=> :track
15
15
  #
16
16
  # @return [Symbol] Name of the class.
17
- def self.media_type_sym; :track; end
17
+ def self.resource_label_sym; super; end
18
18
  end
19
19
  end
@@ -12,10 +12,10 @@ module Helix
12
12
  #
13
13
  #
14
14
  # @example
15
- # Helix::Video.media_type_sym #=> :video
15
+ # Helix::Video.resource_label_sym #=> :video
16
16
  #
17
17
  # @return [Symbol] Name of the class.
18
- def self.media_type_sym; :video; end
18
+ def self.resource_label_sym; super; end
19
19
 
20
20
  def self.slice(attrs={})
21
21
  rest_post(:slice, attrs)
@@ -68,7 +68,7 @@ module Helix
68
68
 
69
69
  def generic_download(opts)
70
70
  content_type = opts[:content_type] || ''
71
- url = config.build_url(action: opts[:action], content_type: content_type, guid: guid, media_type: plural_media_type)
71
+ url = config.build_url(action: opts[:action], content_type: content_type, guid: guid, resource_label: plural_resource_label)
72
72
  RestClient.get(url, params: {signature: config.signature(:view)})
73
73
  end
74
74
 
@@ -7,8 +7,8 @@ describe Helix::Album do
7
7
  subject { klass }
8
8
  its(:ancestors) { should include(Helix::Base) }
9
9
  its(:guid_name) { should eq('album_id') }
10
- its(:media_type_sym) { should be(:album) }
11
- its(:plural_media_type) { should eq('albums') }
10
+ its(:resource_label_sym) { should be(:album) }
11
+ its(:plural_resource_label) { should eq('albums') }
12
12
  [:find, :create, :all, :find_all, :where].each do |crud_call|
13
13
  it { should respond_to(crud_call) }
14
14
  end
@@ -26,7 +26,7 @@ describe Helix::Album do
26
26
  describe "an instance" do
27
27
  let(:obj) { klass.new({'album_id' => 'some_album_guid'}) }
28
28
  subject { obj }
29
- its(:media_type_sym) { should be(:album) }
29
+ its(:resource_label_sym) { should be(:album) }
30
30
  describe "#update" do
31
31
  let(:meth) { :update }
32
32
  it "should raise an error" do
@@ -5,10 +5,10 @@ describe Helix::Base do
5
5
 
6
6
  def set_stubs(obj, even_sig=false)
7
7
  obj.instance_variable_set(:@attributes, {})
8
- obj.stub(:media_type_sym) { :video }
9
- obj.stub(:plural_media_type) { 'videos' }
10
- obj.stub(:guid) { 'some_guid' }
11
- obj.stub(:signature) { 'some_sig' } if even_sig
8
+ obj.stub(:resource_label_sym) { :video }
9
+ obj.stub(:plural_resource_label) { 'videos' }
10
+ obj.stub(:guid) { 'some_guid' }
11
+ obj.stub(:signature) { 'some_sig' } if even_sig
12
12
  end
13
13
 
14
14
  let(:klass) { Helix::Base }
@@ -18,7 +18,7 @@ describe Helix::Base do
18
18
  describe "Constants" do
19
19
  describe "METHODS_DELEGATED_TO_CLASS" do
20
20
  subject { klass::METHODS_DELEGATED_TO_CLASS }
21
- it { should eq([:guid_name, :media_type_sym, :plural_media_type]) }
21
+ it { should eq([:guid_name, :resource_label_sym, :plural_resource_label]) }
22
22
  end
23
23
  end
24
24
 
@@ -41,21 +41,21 @@ describe Helix::Base do
41
41
  before(:each) do Helix::Config.stub(:instance) { mock_config } end
42
42
  context "when given a config instances and an opts Hash" do
43
43
  let(:opts) { {opts_key1: :opts_val1} }
44
- let(:plural_media_type) { :videos }
45
- before(:each) do klass.stub(:plural_media_type) { plural_media_type } end
44
+ let(:plural_resource_label) { :videos }
45
+ before(:each) do klass.stub(:plural_resource_label) { plural_resource_label } end
46
46
  it "should build a XML URL -> the_url" do
47
- mock_config.should_receive(:build_url).with(content_type: :xml,
48
- media_type: plural_media_type)
47
+ mock_config.should_receive(:build_url).with(content_type: :xml,
48
+ resource_label: plural_resource_label)
49
49
  klass.send(meth, opts)
50
50
  end
51
51
  it "should get_response(the_url, {sig_type: :view}.merge(opts) -> raw_response" do
52
52
  mock_config.should_receive(:get_response).with(:built_url, {sig_type: :view}.merge(opts))
53
53
  klass.send(meth, opts)
54
54
  end
55
- it "should read raw_response[plural_media_type] -> data_sets" do
55
+ it "should read raw_response[plural_resource_label] -> data_sets" do
56
56
  mock_raw_response = mock(Object)
57
57
  mock_config.stub(:get_response) { mock_raw_response }
58
- mock_raw_response.should_receive(:[]).with(plural_media_type)
58
+ mock_raw_response.should_receive(:[]).with(plural_resource_label)
59
59
  klass.send(meth, opts)
60
60
  end
61
61
  context "when data_sets is nil" do
@@ -63,7 +63,7 @@ describe Helix::Base do
63
63
  end
64
64
  context "when data_sets is NOT nil" do
65
65
  let(:data_set) { (0..2).to_a }
66
- before(:each) do mock_config.stub(:get_response) { {plural_media_type => data_set } } end
66
+ before(:each) do mock_config.stub(:get_response) { {plural_resource_label => data_set } } end
67
67
  it "should map instantiation with attributes: each data set element" do
68
68
  klass.should_receive(:new).with(attributes: data_set[0], config: mock_config) { :a }
69
69
  klass.should_receive(:new).with(attributes: data_set[1], config: mock_config) { :b }
@@ -79,21 +79,21 @@ describe Helix::Base do
79
79
  subject { klass.method(meth) }
80
80
  before(:each) do Helix::Config.stub(:instance) { mock_config } end
81
81
  context "when given a config instances and NO opts Hash" do
82
- let(:plural_media_type) { :videos }
83
- before(:each) do klass.stub(:plural_media_type) { plural_media_type } end
82
+ let(:plural_resource_label) { :videos }
83
+ before(:each) do klass.stub(:plural_resource_label) { plural_resource_label } end
84
84
  it "should build a XML URL -> the_url" do
85
- mock_config.should_receive(:build_url).with(content_type: :xml,
86
- media_type: plural_media_type)
85
+ mock_config.should_receive(:build_url).with(content_type: :xml,
86
+ resource_label: plural_resource_label)
87
87
  klass.send(meth)
88
88
  end
89
89
  it "should get_response(the_url, {sig_type: :view} -> raw_response" do
90
90
  mock_config.should_receive(:get_response).with(:built_url, {sig_type: :view})
91
91
  klass.send(meth)
92
92
  end
93
- it "should read raw_response[plural_media_type] -> data_sets" do
93
+ it "should read raw_response[plural_resource_label] -> data_sets" do
94
94
  mock_raw_response = mock(Object)
95
95
  mock_config.stub(:get_response) { mock_raw_response }
96
- mock_raw_response.should_receive(:[]).with(plural_media_type)
96
+ mock_raw_response.should_receive(:[]).with(plural_resource_label)
97
97
  klass.send(meth)
98
98
  end
99
99
  context "when data_sets is nil" do
@@ -101,7 +101,7 @@ describe Helix::Base do
101
101
  end
102
102
  context "when data_sets is NOT nil" do
103
103
  let(:data_set) { (0..2).to_a }
104
- before(:each) do mock_config.stub(:get_response) { {plural_media_type => data_set } } end
104
+ before(:each) do mock_config.stub(:get_response) { {plural_resource_label => data_set } } end
105
105
  it "should map instantiation with attributes: each data set element" do
106
106
  klass.should_receive(:new).with(attributes: data_set[0], config: mock_config) { :a }
107
107
  klass.should_receive(:new).with(attributes: data_set[1], config: mock_config) { :b }
@@ -227,15 +227,15 @@ describe Helix::Base do
227
227
  obj.stub(:massage_raw_attrs) { :massaged_attrs }
228
228
  mock_config.stub(:build_url) { :expected_url }
229
229
  mock_config.stub(:get_response) { :raw_attrs }
230
- klass.stub(:media_type_sym) { :video }
230
+ klass.stub(:resource_label_sym) { :video }
231
231
  end
232
232
  shared_examples_for "builds URL for load" do
233
233
  it "should call #guid" do
234
234
  obj.should_receive(:guid) { 'some_guid' }
235
235
  obj.send(meth)
236
236
  end
237
- it "should build_url(content_type: :json, guid: the_guid, media_type: 'videos')" do
238
- mock_config.should_receive(:build_url).with(content_type: :json, guid: 'some_guid', media_type: 'videos')
237
+ it "should build_url(content_type: :json, guid: the_guid, resource_label: 'videos')" do
238
+ mock_config.should_receive(:build_url).with(content_type: :json, guid: 'some_guid', resource_label: 'videos')
239
239
  RestClient.stub(:put)
240
240
  obj.send(meth)
241
241
  end
@@ -5,10 +5,10 @@ describe Helix::Config do
5
5
 
6
6
  def set_stubs(obj, even_sig=false)
7
7
  obj.instance_variable_set(:@attributes, {})
8
- obj.stub(:media_type_sym) { :video }
9
- obj.stub(:plural_media_type) { 'videos' }
10
- obj.stub(:guid) { 'some_guid' }
11
- obj.stub(:signature) { 'some_sig' } if even_sig
8
+ obj.stub(:resource_label_sym) { :video }
9
+ obj.stub(:plural_resource_label) { 'videos' }
10
+ obj.stub(:guid) { 'some_guid' }
11
+ obj.stub(:signature) { 'some_sig' } if even_sig
12
12
  end
13
13
 
14
14
  let(:klass) { Helix::Config }
@@ -107,10 +107,10 @@ describe Helix::Config do
107
107
  end
108
108
  end
109
109
 
110
- def build_test_url(site, sub_url, guid, action, media_type, content_type)
110
+ def build_test_url(site, sub_url, guid, action, resource_label, content_type)
111
111
  expected_url = site
112
112
  expected_url += sub_url unless guid || action == :create_many
113
- expected_url += "/#{media_type}"
113
+ expected_url += "/#{resource_label}"
114
114
  expected_url += "/the_guid" if guid
115
115
  expected_url += "/#{action}" if action
116
116
  expected_url += ".#{content_type}"
@@ -122,11 +122,11 @@ describe Helix::Config do
122
122
  subject { obj.method(meth) }
123
123
  its(:arity) { should be(-1) }
124
124
  before(:each) do obj.credentials = { site: site } end
125
- shared_examples_for "reads scope from credentials for build_url" do |media_type,content_type,more_opts|
125
+ shared_examples_for "reads scope from credentials for build_url" do |resource_label,content_type,more_opts|
126
126
  let(:opts) { more_opts || {} }
127
127
  let(:action) { opts[:action] }
128
128
  let(:guid) { opts[:guid] }
129
- let(:url_pieces) { [site, sub_url, guid, action, media_type, content_type] }
129
+ let(:url_pieces) { [site, sub_url, guid, action, resource_label, content_type] }
130
130
  let(:expected_url) { build_test_url(*url_pieces) }
131
131
  before(:each) do obj.credentials = {site: 'http://example.com'} end
132
132
  context "and credentials has a key for :reseller" do
@@ -187,22 +187,22 @@ describe Helix::Config do
187
187
  subject { obj.send(meth, {guid: :the_guid, action: :the_action}) }
188
188
  it_behaves_like "reads scope from credentials for build_url", :videos, :xml, {guid: :the_guid, action: :the_action}
189
189
  end
190
- [ :videos, :tracks ].each do |media_type|
191
- context "when given opts[:media_type] of :#{media_type}" do
192
- subject { obj.send(meth, media_type: media_type) }
193
- it_behaves_like "reads scope from credentials for build_url", media_type, :xml
190
+ [ :videos, :tracks ].each do |resource_label|
191
+ context "when given opts[:resource_label] of :#{resource_label}" do
192
+ subject { obj.send(meth, resource_label: resource_label) }
193
+ it_behaves_like "reads scope from credentials for build_url", resource_label, :xml
194
194
  end
195
- context "when given opts[:media_type] of :#{media_type} and opts[:guid] of :the_guid" do
196
- subject { obj.send(meth, media_type: media_type, guid: :the_guid) }
197
- it_behaves_like "reads scope from credentials for build_url", media_type, :xml, {guid: :the_guid}
195
+ context "when given opts[:resource_label] of :#{resource_label} and opts[:guid] of :the_guid" do
196
+ subject { obj.send(meth, resource_label: resource_label, guid: :the_guid) }
197
+ it_behaves_like "reads scope from credentials for build_url", resource_label, :xml, {guid: :the_guid}
198
198
  end
199
- context "when given opts[:media_type] of :#{media_type} and opts[:action] of :the_action" do
200
- subject { obj.send(meth, media_type: media_type, action: :the_action) }
201
- it_behaves_like "reads scope from credentials for build_url", media_type, :xml, {action: :the_action}
199
+ context "when given opts[:resource_label] of :#{resource_label} and opts[:action] of :the_action" do
200
+ subject { obj.send(meth, resource_label: resource_label, action: :the_action) }
201
+ it_behaves_like "reads scope from credentials for build_url", resource_label, :xml, {action: :the_action}
202
202
  end
203
- context "when given opts[:media_type] of :#{media_type}, opts[:guid] of :the_guid, opts[:action] of :the_action" do
204
- subject { obj.send(meth, media_type: media_type, guid: :the_guid, action: :the_action) }
205
- it_behaves_like "reads scope from credentials for build_url", media_type, :xml, {guid: :the_guid, action: :the_action}
203
+ context "when given opts[:resource_label] of :#{resource_label}, opts[:guid] of :the_guid, opts[:action] of :the_action" do
204
+ subject { obj.send(meth, resource_label: resource_label, guid: :the_guid, action: :the_action) }
205
+ it_behaves_like "reads scope from credentials for build_url", resource_label, :xml, {guid: :the_guid, action: :the_action}
206
206
  end
207
207
  end
208
208
  [ :json, :xml ].each do |content_type|
@@ -222,31 +222,31 @@ describe Helix::Config do
222
222
  subject { obj.send(meth, content_type: content_type, guid: :the_guid, action: :the_action) }
223
223
  it_behaves_like "reads scope from credentials for build_url", :videos, content_type, {guid: :the_guid, action: :the_action}
224
224
  end
225
- [ :videos, :tracks ].each do |media_type|
226
- context "when given opts[:content_type] of :#{content_type} and opts[:media_type] of :#{media_type}" do
227
- subject { obj.send(meth, content_type: content_type, media_type: media_type) }
228
- it_behaves_like "reads scope from credentials for build_url", media_type, content_type
225
+ [ :videos, :tracks ].each do |resource_label|
226
+ context "when given opts[:content_type] of :#{content_type} and opts[:resource_label] of :#{resource_label}" do
227
+ subject { obj.send(meth, content_type: content_type, resource_label: resource_label) }
228
+ it_behaves_like "reads scope from credentials for build_url", resource_label, content_type
229
229
  end
230
- context "when given opts[:content_type] of :#{content_type}, opts[:guid] of :the_guid, and opts[:media_type] of :#{media_type}" do
231
- subject { obj.send(meth, content_type: content_type, guid: :the_guid, media_type: media_type) }
232
- it_behaves_like "reads scope from credentials for build_url", media_type, content_type, {guid: :the_guid}
230
+ context "when given opts[:content_type] of :#{content_type}, opts[:guid] of :the_guid, and opts[:resource_label] of :#{resource_label}" do
231
+ subject { obj.send(meth, content_type: content_type, guid: :the_guid, resource_label: resource_label) }
232
+ it_behaves_like "reads scope from credentials for build_url", resource_label, content_type, {guid: :the_guid}
233
233
  end
234
- context "when given opts[:content_type] of :#{content_type}, opts[:action] of :the_action, and opts[:media_type] of :#{media_type}" do
235
- subject { obj.send(meth, content_type: content_type, action: :the_action, media_type: media_type) }
236
- it_behaves_like "reads scope from credentials for build_url", media_type, content_type, {action: :the_action}
234
+ context "when given opts[:content_type] of :#{content_type}, opts[:action] of :the_action, and opts[:resource_label] of :#{resource_label}" do
235
+ subject { obj.send(meth, content_type: content_type, action: :the_action, resource_label: resource_label) }
236
+ it_behaves_like "reads scope from credentials for build_url", resource_label, content_type, {action: :the_action}
237
237
  end
238
- context "when given opts[:content_type] of :#{content_type}, opts[:guid] of :the_guid, opts[:action] of :the_action, and opts[:media_type] of :#{media_type}" do
239
- subject { obj.send(meth, content_type: content_type, guid: :the_guid, action: :the_action, media_type: media_type) }
240
- it_behaves_like "reads scope from credentials for build_url", media_type, content_type, {guid: :the_guid, action: :the_action}
238
+ context "when given opts[:content_type] of :#{content_type}, opts[:guid] of :the_guid, opts[:action] of :the_action, and opts[:resource_label] of :#{resource_label}" do
239
+ subject { obj.send(meth, content_type: content_type, guid: :the_guid, action: :the_action, resource_label: resource_label) }
240
+ it_behaves_like "reads scope from credentials for build_url", resource_label, content_type, {guid: :the_guid, action: :the_action}
241
241
  end
242
242
  end
243
243
  end
244
- dl_opts = {action: :file, content_type: '', guid: :the_guid, media_type: :videos}
244
+ dl_opts = {action: :file, content_type: '', guid: :the_guid, resource_label: :videos}
245
245
  context "when given opts of #{dl_opts}" do
246
246
  subject { obj.send(meth, dl_opts) }
247
247
  it { should eq("http://example.com/videos/the_guid/file") }
248
248
  end
249
- dp_opts = {action: :play, content_type: '', guid: :the_guid, media_type: :videos}
249
+ dp_opts = {action: :play, content_type: '', guid: :the_guid, resource_label: :videos}
250
250
  context "when given opts of #{dp_opts}" do
251
251
  subject { obj.send(meth, dp_opts) }
252
252
  it { should eq("http://example.com/videos/the_guid/play") }
@@ -16,9 +16,10 @@ describe Helix::DurationedMedia do
16
16
 
17
17
  let(:sig_opts) { { contributor: :helix,
18
18
  library_id: :development } }
19
- url_opts = { action: :create_many,
20
- media_type: klass.send(:plural_media_type),
21
- content_type: :xml }
19
+
20
+ url_opts = { action: :create_many,
21
+ resource_label: klass.send(:plural_resource_label),
22
+ content_type: :xml }
22
23
 
23
24
  describe ".import" do
24
25
  let(:meth) { :import }
@@ -89,4 +90,4 @@ describe Helix::DurationedMedia do
89
90
  end
90
91
  end
91
92
  end
92
- end
93
+ end
@@ -7,8 +7,8 @@ describe Helix::Image do
7
7
  subject { klass }
8
8
  its(:ancestors) { should include(Helix::Base) }
9
9
  its(:guid_name) { should eq('image_id') }
10
- its(:media_type_sym) { should be(:image) }
11
- its(:plural_media_type) { should eq('images') }
10
+ its(:resource_label_sym) { should be(:image) }
11
+ its(:plural_resource_label) { should eq('images') }
12
12
  [:find, :create, :all, :find_all, :where].each do |crud_call|
13
13
  it { should respond_to(crud_call) }
14
14
  end
@@ -18,7 +18,7 @@ describe Helix::Image do
18
18
  describe "an instance" do
19
19
  let(:obj) { klass.new({'image_id' => 'some_image_guid'}) }
20
20
  subject { obj }
21
- its(:media_type_sym) { should be(:image) }
21
+ its(:resource_label_sym) { should be(:image) }
22
22
  [:destroy, :update].each do |crud_call|
23
23
  it { should respond_to(crud_call) }
24
24
  end
@@ -6,8 +6,8 @@ describe Helix::Library do
6
6
  let(:klass) { Helix::Library }
7
7
  subject { klass }
8
8
  its(:guid_name) { should eq('library_id') }
9
- its(:media_type_sym) { should be(:library) }
10
- its(:plural_media_type) { should eq('libraries') }
9
+ its(:resource_label_sym) { should be(:library) }
10
+ its(:plural_resource_label) { should eq('libraries') }
11
11
  [:find, :create, :all, :find_all, :where].each do |crud_call|
12
12
  it { should respond_to(crud_call) }
13
13
  end
@@ -28,7 +28,7 @@ describe Helix::Library do
28
28
  describe "an instance" do
29
29
  let(:obj) { klass.new({'library_id' => 'some_library_id'}) }
30
30
  subject { obj }
31
- its(:media_type_sym) { should be(:library) }
31
+ its(:resource_label_sym) { should be(:library) }
32
32
  [:destroy, :update].each do |crud_call|
33
33
  it { should respond_to(crud_call) }
34
34
  end
@@ -18,15 +18,15 @@ describe Helix::Media do
18
18
  let(:params) { { signature: "some_sig" } }
19
19
  let(:expected) { { attributes: { attribute: :value }, config: mock_config } }
20
20
  before(:each) do
21
- klass.stub(:plural_media_type) { :klasses }
22
- klass.stub(:media_type_sym) { klass_sym }
23
- mock_config.stub(:build_url).with(action: :create_many, media_type: :klasses) { :url }
21
+ klass.stub(:plural_resource_label) { :klasses }
22
+ klass.stub(:resource_label_sym) { klass_sym }
23
+ mock_config.stub(:build_url).with(action: :create_many, resource_label: :klasses) { :url }
24
24
  mock_config.stub(:signature).with(:update) { "some_sig" }
25
25
  Helix::Config.stub(:instance) { mock_config }
26
26
  end
27
27
  it "should get an ingest signature" do
28
- mock_config.should_receive(:build_url).with(media_type: :klasses,
29
- content_type: :xml)
28
+ mock_config.should_receive(:build_url).with(resource_label: :klasses,
29
+ content_type: :xml)
30
30
  RestClient.stub(:post).with(:url, params) { resp_json }
31
31
  Hash.should_receive(:from_xml).with(resp_json) { resp_value }
32
32
  klass.stub(:new).with(expected)
@@ -34,8 +34,8 @@ describe Helix::Media do
34
34
  klass.send(meth)
35
35
  end
36
36
  it "should do an HTTP post call, parse response and call new" do
37
- mock_config.should_receive(:build_url).with(media_type: :klasses,
38
- content_type: :xml)
37
+ mock_config.should_receive(:build_url).with(resource_label: :klasses,
38
+ content_type: :xml)
39
39
  RestClient.should_receive(:post).with(:url, params) { resp_json }
40
40
  Hash.should_receive(:from_xml).with(resp_json) { resp_value }
41
41
  klass.should_receive(:new).with(expected)
@@ -89,20 +89,20 @@ describe Helix::Media do
89
89
  before do
90
90
  obj.stub(:config) { mock_config }
91
91
  obj.stub(:guid) { :some_guid }
92
- obj.stub(:plural_media_type) { :media_type }
92
+ obj.stub(:plural_resource_label) { :resource_label }
93
93
  end
94
94
  it "should get an update signature" do
95
- url = mock_config.build_url(media_type: :media_type,
96
- guid: :some_guid,
97
- content_type: :xml)
95
+ url = mock_config.build_url(resource_label: :resource_label,
96
+ guid: :some_guid,
97
+ content_type: :xml)
98
98
  RestClient.stub(:delete).with(url, params)
99
99
  mock_config.should_receive(:signature).with(:update) { :some_sig }
100
100
  obj.send(meth)
101
101
  end
102
102
  it "should call for an HTTP delete and return nil" do
103
- url = mock_config.build_url(media_type: :media_type,
104
- guid: :some_guid,
105
- content_type: :xml)
103
+ url = mock_config.build_url(resource_label: :resource_label,
104
+ guid: :some_guid,
105
+ content_type: :xml)
106
106
  RestClient.should_receive(:delete).with(url, params)
107
107
  expect(obj.send(meth)).to be_nil
108
108
  end
@@ -115,14 +115,14 @@ describe Helix::Media do
115
115
  before(:each) do
116
116
  obj.stub(:config) { mock_config }
117
117
  obj.stub(:guid) { :the_guid }
118
- obj.stub(:media_type_sym) { :video }
119
- obj.stub(:plural_media_type) { :the_media_type }
118
+ obj.stub(:resource_label_sym) { :video }
119
+ obj.stub(:plural_resource_label) { :the_resource_label }
120
120
  mock_config.stub(:signature).with(:update) { 'some_sig' }
121
121
  mock_config.stub(:build_url) { :expected_url }
122
122
  end
123
123
  shared_examples_for "builds URL for update" do
124
- it "should build_url(content_type: :xml, guid: guid, media_type: plural_media_type)" do
125
- mock_config.should_receive(:build_url).with(content_type: :xml, guid: :the_guid, media_type: :the_media_type)
124
+ it "should build_url(content_type: :xml, guid: guid, resource_label: plural_resource_label)" do
125
+ mock_config.should_receive(:build_url).with(content_type: :xml, guid: :the_guid, resource_label: :the_resource_label)
126
126
  RestClient.stub(:put)
127
127
  obj.send(meth)
128
128
  end
@@ -18,12 +18,12 @@ describe Helix::Statistics do
18
18
  describe "Constants"
19
19
 
20
20
  STATS_TYPES.each do |stats_type|
21
- STATS_MEDIA_TYPES.each do |media_type|
21
+ STATS_MEDIA_TYPES.each do |resource_label|
22
22
 
23
- next if STATS_IMAGE_TYPES.include?(media_type) and stats_type == 'ingest'
23
+ next if STATS_IMAGE_TYPES.include?(resource_label) and stats_type == 'ingest'
24
24
 
25
- describe ".#{media_type}_#{stats_type}" do
26
- let(:meth) { "#{media_type}_#{stats_type}" }
25
+ describe ".#{resource_label}_#{stats_type}" do
26
+ let(:meth) { "#{resource_label}_#{stats_type}" }
27
27
  let(:mock_config) { mock(Helix::Config, build_url: :built_url, get_response: :response) }
28
28
  before(:each) do Helix::Config.stub(:instance) { mock_config } end
29
29
 
@@ -32,7 +32,7 @@ describe Helix::Statistics do
32
32
 
33
33
  case stats_type
34
34
  when 'delivery'
35
- media_name = MEDIA_NAME_OF[media_type] || media_type
35
+ media_name = MEDIA_NAME_OF[resource_label] || resource_label
36
36
  context "when given opts containing a :#{media_name}_id" do
37
37
  let(:opts) { {group: :daily, "#{media_name}_id".to_sym => "the_#{media_name}_id".to_sym} }
38
38
  it "should refer to the Helix::Config instance" do
@@ -51,10 +51,10 @@ describe Helix::Statistics do
51
51
  end
52
52
  context "when opts contains a :content_type" do
53
53
  before(:each) do opts.merge!(content_type: :the_format) end
54
- it "should call config.build_url(guid: the_#{media_name}_id, media_type: :#{media_name}s, action: :statistics, content_type: :the_format)" do
54
+ it "should call config.build_url(guid: the_#{media_name}_id, resource_label: :#{media_name}s, action: :statistics, content_type: :the_format)" do
55
55
  build_opts_url = {
56
56
  guid: "the_#{media_name}_id".to_sym,
57
- media_type: "#{media_name}s".to_sym,
57
+ resource_label: "#{media_name}s".to_sym,
58
58
  action: :statistics,
59
59
  content_type: :the_format
60
60
  }
@@ -63,8 +63,8 @@ describe Helix::Statistics do
63
63
  end
64
64
  end
65
65
  context "when opts did NOT contain a :content_type" do
66
- it "should call config.build_url(guid: the_#{media_name}_id, media_type: :#{media_name}s, action: :statistics)" do
67
- mock_config.should_receive(:build_url).with({guid: "the_#{media_name}_id".to_sym, media_type: "#{media_name}s".to_sym, action: :statistics}) { :built_url }
66
+ it "should call config.build_url(guid: the_#{media_name}_id, resource_label: :#{media_name}s, action: :statistics)" do
67
+ mock_config.should_receive(:build_url).with({guid: "the_#{media_name}_id".to_sym, resource_label: "#{media_name}s".to_sym, action: :statistics}) { :built_url }
68
68
  mod.send(meth, opts)
69
69
  end
70
70
  end
@@ -91,15 +91,15 @@ describe Helix::Statistics do
91
91
  end
92
92
  context "when opts contains a :content_type" do
93
93
  before(:each) do opts.merge!(content_type: :the_format) end
94
- it "should call config.build_url(media_type: :statistics, action: :#{media_name}_delivery, content_type: :the_format)" do
95
- build_url_opts = {media_type: :statistics, action: "#{media_name}_delivery".to_sym, content_type: :the_format}
94
+ it "should call config.build_url(resource_label: :statistics, action: :#{media_name}_delivery, content_type: :the_format)" do
95
+ build_url_opts = {resource_label: :statistics, action: "#{media_name}_delivery".to_sym, content_type: :the_format}
96
96
  mock_config.should_receive(:build_url).with(build_url_opts) { :built_url }
97
97
  mod.send(meth, opts)
98
98
  end
99
99
  end
100
100
  context "when opts did NOT contain a :content_type" do
101
- it "should call config.build_url(media_type: :statistics, action: :#{media_name}_delivery)" do
102
- mock_config.should_receive(:build_url).with({media_type: :statistics, action: "#{media_name}_delivery".to_sym}) { :built_url }
101
+ it "should call config.build_url(resource_label: :statistics, action: :#{media_name}_delivery)" do
102
+ mock_config.should_receive(:build_url).with({resource_label: :statistics, action: "#{media_name}_delivery".to_sym}) { :built_url }
103
103
  mod.send(meth, opts)
104
104
  end
105
105
  end
@@ -109,8 +109,8 @@ describe Helix::Statistics do
109
109
  end
110
110
  end
111
111
  when 'ingest'
112
- media_name = MEDIA_NAME_OF[media_type] || media_type
113
- publish_name = INGEST_NAME_OF[media_type] || 'ingest'
112
+ media_name = MEDIA_NAME_OF[resource_label] || resource_label
113
+ publish_name = INGEST_NAME_OF[resource_label] || 'ingest'
114
114
  context "when given opts" do
115
115
  context "and opts has no :action key" do
116
116
  let(:opts) { {group: :daily} }
@@ -118,8 +118,8 @@ describe Helix::Statistics do
118
118
  Helix::Config.should_receive(:instance) { mock_config }
119
119
  mod.send(meth, opts)
120
120
  end
121
- it "should call config.build_url(media_type: :statistics, action: :#{media_name}_#{publish_name}/brakdown)" do
122
- mock_config.should_receive(:build_url).with({media_type: :statistics, action: "#{media_name}_#{publish_name}/breakdown".to_sym}) { :built_url }
121
+ it "should call config.build_url(resource_label: :statistics, action: :#{media_name}_#{publish_name}/brakdown)" do
122
+ mock_config.should_receive(:build_url).with({resource_label: :statistics, action: "#{media_name}_#{publish_name}/breakdown".to_sym}) { :built_url }
123
123
  mod.send(meth, opts)
124
124
  end
125
125
  it "should return config.get_response(built_url, opts.merge(sig_type: :view)" do
@@ -134,8 +134,8 @@ describe Helix::Statistics do
134
134
  Helix::Config.should_receive(:instance) { mock_config }
135
135
  mod.send(meth, opts)
136
136
  end
137
- it "should call config.build_url(media_type: :statistics, action: :#{media_name}_#{publish_name}/#{act})" do
138
- mock_config.should_receive(:build_url).with({media_type: :statistics, action: "#{media_name}_#{publish_name}/#{act}".to_sym}) { :built_url }
137
+ it "should call config.build_url(resource_label: :statistics, action: :#{media_name}_#{publish_name}/#{act})" do
138
+ mock_config.should_receive(:build_url).with({resource_label: :statistics, action: "#{media_name}_#{publish_name}/#{act}".to_sym}) { :built_url }
139
139
  mod.send(meth, opts)
140
140
  end
141
141
  it "should return config.get_response(built_url, opts.merge(sig_type: :view)" do
@@ -146,16 +146,16 @@ describe Helix::Statistics do
146
146
  end
147
147
  end
148
148
  when 'storage'
149
- media_name = MEDIA_NAME_OF[media_type] || media_type
150
- publish_name = INGEST_NAME_OF[media_type] || 'ingest'
149
+ media_name = MEDIA_NAME_OF[resource_label] || resource_label
150
+ publish_name = INGEST_NAME_OF[resource_label] || 'ingest'
151
151
  context "when given opts" do
152
152
  let(:opts) { {group: :daily} }
153
153
  it "should refer to the Helix::Config instance" do
154
154
  Helix::Config.should_receive(:instance) { mock_config }
155
155
  mod.send(meth, opts)
156
156
  end
157
- it "should call config.build_url(media_type: :statistics, action: :#{media_name}_#{publish_name}/disk_usage)" do
158
- mock_config.should_receive(:build_url).with({media_type: :statistics, action: "#{media_name}_#{publish_name}/disk_usage".to_sym}) { :built_url }
157
+ it "should call config.build_url(resource_label: :statistics, action: :#{media_name}_#{publish_name}/disk_usage)" do
158
+ mock_config.should_receive(:build_url).with({resource_label: :statistics, action: "#{media_name}_#{publish_name}/disk_usage".to_sym}) { :built_url }
159
159
  mod.send(meth, opts)
160
160
  end
161
161
  it "should return config.get_response(built_url, opts.merge(sig_type: :view)" do
@@ -3,10 +3,10 @@ require 'helix'
3
3
 
4
4
  describe Helix::Tag do
5
5
 
6
- let(:klass) { Helix::Tag }
7
- subject { klass }
8
- its(:media_type_sym) { should be(:tag) }
9
- its(:plural_media_type) { should eq('tags') }
6
+ let(:klass) { Helix::Tag }
7
+ subject { klass }
8
+ its(:resource_label_sym) { should be(:tag) }
9
+ its(:plural_resource_label) { should eq('tags') }
10
10
  it { should_not respond_to(:find) }
11
11
  it { should_not respond_to(:create) }
12
12
  it { should respond_to(:all)}
@@ -15,10 +15,10 @@ describe Helix::Tag do
15
15
  describe "Constants"
16
16
 
17
17
  describe "an instance" do
18
- let(:obj) { klass.new({}) }
19
- subject { obj }
20
- its(:media_type_sym) { should be(:tag) }
18
+ let(:obj) { klass.new({}) }
19
+ subject { obj }
20
+ its(:resource_label_sym) { should be(:tag) }
21
21
  it { should_not respond_to(:destroy) }
22
22
  it { should_not respond_to(:update) }
23
23
  end
24
- end
24
+ end
@@ -6,8 +6,8 @@ describe Helix::Track do
6
6
  let(:klass) { Helix::Track }
7
7
  subject { klass }
8
8
  its(:guid_name) { should eq('track_id') }
9
- its(:media_type_sym) { should be(:track) }
10
- its(:plural_media_type) { should eq('tracks') }
9
+ its(:resource_label_sym) { should be(:track) }
10
+ its(:plural_resource_label) { should eq('tracks') }
11
11
  [:find, :create, :all, :find_all, :where].each do |crud_call|
12
12
  it { should respond_to(crud_call) }
13
13
  end
@@ -17,7 +17,7 @@ describe Helix::Track do
17
17
  describe "an instance" do
18
18
  let(:obj) { klass.new({'track_id' => 'some_track_guid'}) }
19
19
  subject { obj }
20
- its(:media_type_sym) { should be(:track) }
20
+ its(:resource_label_sym) { should be(:track) }
21
21
  [:destroy, :update].each do |crud_call|
22
22
  it { should respond_to(crud_call) }
23
23
  end
@@ -10,8 +10,8 @@ describe Helix::Video do
10
10
  let(:klass) { Helix::Video }
11
11
  subject { klass }
12
12
  its(:guid_name) { should eq('video_id') }
13
- its(:media_type_sym) { should be(:video) }
14
- its(:plural_media_type) { should eq('videos') }
13
+ its(:resource_label_sym) { should be(:video) }
14
+ its(:plural_resource_label) { should eq('videos') }
15
15
  [:find, :create, :all, :find_all, :where].each do |crud_call|
16
16
  it { should respond_to(crud_call) }
17
17
  end
@@ -23,7 +23,7 @@ describe Helix::Video do
23
23
  describe "an instance" do
24
24
  let(:obj) { klass.new({video_id: 'some_video_guid'}) }
25
25
  subject { obj }
26
- its(:media_type_sym) { should be(:video) }
26
+ its(:resource_label_sym) { should be(:video) }
27
27
 
28
28
  describe "#download" do
29
29
  let(:meth) { :download }
@@ -33,11 +33,11 @@ describe Helix::Video do
33
33
  before do
34
34
  obj.stub(:config) { mock_config }
35
35
  obj.stub(:guid) { :some_guid }
36
- obj.stub(:plural_media_type) { :media_type }
36
+ obj.stub(:plural_resource_label) { :resource_label }
37
37
  RestClient.stub(:get) { '' }
38
38
  end
39
39
  { '' => '', mp3: :mp3, nil => '' }.each do |arg,actual|
40
- build_url_h = {action: :file, content_type: actual, guid: :some_guid, media_type: :media_type}
40
+ build_url_h = {action: :file, content_type: actual, guid: :some_guid, resource_label: :resource_label}
41
41
  context "when given {content_type: #{arg}" do
42
42
  it "should build_url(#{build_url_h})" do
43
43
  mock_config.should_receive(:build_url).with(build_url_h)
@@ -64,11 +64,11 @@ describe Helix::Video do
64
64
  before do
65
65
  obj.stub(:config) { mock_config }
66
66
  obj.stub(:guid) { :some_guid }
67
- obj.stub(:plural_media_type) { :media_type }
67
+ obj.stub(:plural_resource_label) { :resource_label }
68
68
  RestClient.stub(:get) { '' }
69
69
  end
70
70
  { '' => '', mp3: :mp3, nil => '' }.each do |arg,actual|
71
- build_url_h = {action: :play, content_type: actual, guid: :some_guid, media_type: :media_type}
71
+ build_url_h = {action: :play, content_type: actual, guid: :some_guid, resource_label: :resource_label}
72
72
  context "when given {content_type: #{arg}" do
73
73
  it "should build_url(#{build_url_h})" do
74
74
  mock_config.should_receive(:build_url).with(build_url_h)
@@ -114,10 +114,10 @@ describe Helix::Video do
114
114
  its(:arity) { should eq(-1) }
115
115
  let(:params) { { params: { signature: :some_sig },
116
116
  content_type: "text/xml" } }
117
- let(:url_opts) { { action: :slice,
118
- media_type: "videos",
119
- content_type: :xml,
120
- formats: :some_format } }
117
+ let(:url_opts) { { action: :slice,
118
+ resource_label: "videos",
119
+ content_type: :xml,
120
+ formats: :some_format } }
121
121
  let(:sig_opts) { { contributor: :helix,
122
122
  library_id: :development,
123
123
  formats: :some_format } }
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: helix
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 8
5
- version: 0.0.2.5.pre
5
+ version: 0.0.2.6.pre
6
6
  platform: ruby
7
7
  authors:
8
8
  - Twistage, Inc