Class: Carriots::ApiMethods::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/carriots/api_methods/options.rb

Overview

general options for Carriots API

Direct Known Subclasses

StreamsOptions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Options

Returns a new instance of Options.



13
14
15
16
17
18
# File 'lib/carriots/api_methods/options.rb', line 13

def initialize(options = {})
  @raw_options = options
  @options = []
  set_options
  @build_options = opts_montati
end

Instance Attribute Details

#build_optionsObject

Returns the value of attribute build_options.



11
12
13
# File 'lib/carriots/api_methods/options.rb', line 11

def build_options
  @build_options
end

#optionsObject

Returns the value of attribute options.



10
11
12
# File 'lib/carriots/api_methods/options.rb', line 10

def options
  @options
end

Instance Method Details

#keysObject



24
25
26
# File 'lib/carriots/api_methods/options.rb', line 24

def keys
  []
end

#opts_montatiObject



32
33
34
35
36
# File 'lib/carriots/api_methods/options.rb', line 32

def opts_montati
  return '' if @options.empty?

  '?' + @options.join('&')
end

#rawObject



20
21
22
# File 'lib/carriots/api_methods/options.rb', line 20

def raw
  @raw_options
end

#set_optionsObject



28
29
30
# File 'lib/carriots/api_methods/options.rb', line 28

def set_options
  keys.each { |key| send("param_#{key}", raw[key]) }
end