Class: AlchemyLanguage::CombinedCall
- Inherits:
-
ActiveModel::Base
- Object
- ActiveMethod::Extra
- ActiveModel::Base
- AlchemyLanguage::CombinedCall
- Defined in:
- lib/alchemy_language/model/combined_call.rb
Instance Attribute Summary
Attributes inherited from ActiveModel::Base
#auth_token, #json_result, #options, #path, #prefix, #type
Instance Method Summary collapse
- #add_dynamic_response_field(name) ⇒ Object
- #check_options ⇒ Object
- #endpoint ⇒ Object
-
#initialize(path, type, options = {}) ⇒ CombinedCall
constructor
A new instance of CombinedCall.
Methods inherited from ActiveModel::Base
#check_prefix, #params_addressable, #request
Methods included from Generators::AlchemyRequest
#base_url, #json_parser, #rest_client_api
Methods inherited from ActiveMethod::Extra
Constructor Details
#initialize(path, type, options = {}) ⇒ CombinedCall
Returns a new instance of CombinedCall.
6 7 8 9 |
# File 'lib/alchemy_language/model/combined_call.rb', line 6 def initialize(path, type, ={}) super end |
Instance Method Details
#add_dynamic_response_field(name) ⇒ Object
27 28 29 30 31 32 |
# 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 ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/alchemy_language/model/combined_call.rb', line 19 def if @options.key?(:extract) @options[:extract].split(',').each do |option| add_dynamic_response_field(option) end end end |
#endpoint ⇒ Object
11 12 13 14 15 16 17 |
# 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 |