module Frodo::Concerns::Base
Constants
- MIME_TYPES
Attributes
options[R]
Public Class Methods
new(opts = {}) { |builder| ... }
click to toggle source
Public: Creates a new client instance
opts - A hash of options to be passed in (default: {}).
:oauth_token - The String oauth access token to authenticate API calls (required unless password authentication is used). :refresh_token - The String refresh token to obtain fresh OAuth access tokens (required if oauth authentication is used). :instance_url - The String base url for all api requests (required if oauth authentication is used). :client_id - The oauth client id to use. Needed for both password and oauth authentication :client_secret - The oauth client secret to use. Required for client_credentials auth flow :tenant_id - The Azure AD tenant id. Required for client_credentials and password auth flows :username - User's dynamics username for password auth flow :password - User's dynamics password for password auth flow :host - The String hostname to use during authentication requests (default: 'login.microsoftonline.com'). :base_path - The base path for the REST api. (default: '/') :authentication_retries - The number of times that client should attempt to reauthenticate before raising an exception (default: 3). :compress - Set to true to have Dynamics compress the response (default: false). :raw_json - Set to true to skip the conversion of Entities responses (default: false). :timeout - Faraday connection request read/open timeout. (default: nil). :proxy_uri - Proxy URI: 'http://proxy.example.com:port' or 'http://user@pass:proxy.example.com:port' :authentication_callback - A Proc that is called with the response body after a successful authentication. :request_headers - A hash containing custom headers that will be appended to each request :with_metadata - Flag to specify if we need to use metadata
# File lib/frodo/concerns/base.rb, line 62 def initialize(opts = {}) raise ArgumentError, 'Please specify a hash of options' unless opts.is_a?(Hash) # allow injecting the service for performance purpose such as # when you have already a local schema @service = opts.delete(:service) @options = Hash[Frodo.configuration.options.map do |option| [option, Frodo.configuration.send(option)] end] @options.merge! opts yield builder if block_given? end
Public Instance Methods
inspect()
click to toggle source
# File lib/frodo/concerns/base.rb, line 86 def inspect "#<#{self.class} @options=#{@options.inspect}>" end
instance_url()
click to toggle source
# File lib/frodo/concerns/base.rb, line 77 def instance_url authenticate! unless options[:instance_url] options[:instance_url] end
service()
click to toggle source
# File lib/frodo/concerns/base.rb, line 82 def service @service ||= Frodo::Service.new(instance_url, strict: false, metadata_document: metadata_on_init, with_metadata: options[:with_metadata] ) end