class AlchemyLanguage::CombinedCall

Public Class Methods

new(path, type, options={}) click to toggle source
Calls superclass method AlchemyLanguage::ActiveModel::Base::new
# File lib/alchemy_language/model/combined_call.rb, line 6
def initialize(path, type, options={})
  super 
  check_options
end

Public Instance Methods

add_dynamic_response_field(name) click to toggle source
# File lib/alchemy_language/model/combined_call.rb, line 27
def add_dynamic_response_field(name)
  self.class.send(:define_method, name) do 
    name = name.to_s.gsub('_', '-')
    @json_result[name.to_s]
  end
end
check_options() click to toggle source
# File lib/alchemy_language/model/combined_call.rb, line 19
def check_options
  if @options.key?(:extract)
    @options[:extract].split(',').each do |option|
      add_dynamic_response_field(option)
    end
  end
end
endpoint() click to toggle source
# File lib/alchemy_language/model/combined_call.rb, line 11
def endpoint
  url = "#{@type}/#{@prefix}GetCombinedData"
  url << "?apikey=#{@auth_token}"
  url << "&#{@type}=#{@path}&outputMode=json"
  url << "&#{params_addressable}" unless params_addressable.empty?
  url
end