Module: Softlayer::Model::Operations
- Included in:
- Softlayer::Model, Softlayer::Model
- Defined in:
- lib/softlayer/model/operations.rb
Class Method Summary collapse
Instance Method Summary collapse
- #filter(filter) ⇒ Object
- #limit(limit, offset = 0) ⇒ Object
- #mask(mask) ⇒ Object
- #request_headers ⇒ Object
Class Method Details
.extended(klass) ⇒ Object
8 9 10 11 |
# File 'lib/softlayer/model/operations.rb', line 8 def self.extended(klass) klass.define_singleton_method("headers=") { |headers| @headers = headers } klass.define_singleton_method("headers") { @headers } end |
.included(base) ⇒ Object
4 5 6 |
# File 'lib/softlayer/model/operations.rb', line 4 def self.included(base) base.send(:attr_accessor, :headers) end |
Instance Method Details
#filter(filter) ⇒ Object
13 14 15 16 17 |
# File 'lib/softlayer/model/operations.rb', line 13 def filter(filter) @filter = Filter.new(service_name, filter) if filter.is_a? Hash or filter.is_a? String @filter = filter if filter.is_a? Filter self end |
#limit(limit, offset = 0) ⇒ Object
19 20 21 22 |
# File 'lib/softlayer/model/operations.rb', line 19 def limit(limit, offset = 0) @limit = Limit.new(limit, offset) self end |
#mask(mask) ⇒ Object
24 25 26 27 28 |
# File 'lib/softlayer/model/operations.rb', line 24 def mask(mask) @mask = Mask.new(service_name, mask) if mask.is_a? Hash or mask.is_a? String @mask = mask if mask.is_a? Mask self end |
#request_headers ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/softlayer/model/operations.rb', line 30 def request_headers headers = {} headers.merge!(@headers) if @headers @headers = nil %w(filter limit mask).each do |header| if instance_variable_get("@#{header}") headers.merge!(instance_variable_get("@#{header}").to_header) instance_variable_set("@#{header}", nil) end end headers end |