Module: Booqable::Configurable
Overview
Instance Attribute Summary collapse
-
#api_domain ⇒ Object
Returns the value of attribute api_domain.
-
#api_endpoint ⇒ String
Base URL for API requests.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#auto_paginate ⇒ Boolean
Auto fetch next page of results until rate limit reached.
-
#client_id ⇒ String
Configure OAuth app key.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#company_id ⇒ Object
Returns the value of attribute company_id.
-
#connection_options ⇒ Hash
Configure connection options for Faraday.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#default_media_type ⇒ String
Configure preferred media type (for API versioning, for example).
-
#middleware ⇒ Faraday::Builder or Faraday::RackBuilder
Configure middleware for Faraday.
-
#no_retries ⇒ Object
Returns the value of attribute no_retries.
-
#per_page ⇒ String
Configure page size for paginated results.
-
#proxy ⇒ String
URI for proxy server.
-
#read_token ⇒ Object
Returns the value of attribute read_token.
-
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
-
#single_use_token ⇒ Object
Returns the value of attribute single_use_token.
-
#single_use_token_algorithm ⇒ Object
Returns the value of attribute single_use_token_algorithm.
-
#single_use_token_company_id ⇒ Object
Returns the value of attribute single_use_token_company_id.
-
#single_use_token_expiration_period ⇒ Object
Returns the value of attribute single_use_token_expiration_period.
-
#single_use_token_private_key ⇒ Object
Returns the value of attribute single_use_token_private_key.
-
#single_use_token_secret ⇒ Object
Returns the value of attribute single_use_token_secret.
-
#single_use_token_user_id ⇒ Object
Returns the value of attribute single_use_token_user_id.
-
#ssl_verify_mode ⇒ String
SSL verify mode for ssl connections.
-
#user_agent ⇒ String
Configure User-Agent header for requests.
-
#write_token ⇒ Object
Returns the value of attribute write_token.
Class Method Summary collapse
-
.keys ⇒ Array
List of configurable keys for Client.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Set configuration options using a block.
-
#debug? ⇒ Boolean
Whether to print debug information.
-
#reset! ⇒ Object
(also: #setup)
Reset configuration options to default values.
-
#same_options?(opts) ⇒ Boolean
Compares client options to a Hash of requested options.
Instance Attribute Details
#api_domain ⇒ Object
Returns the value of attribute api_domain.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def api_domain @api_domain end |
#api_endpoint ⇒ String
Returns Base URL for API requests. default: company.booqable.com/api/4.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/booqable/configurable.rb', line 34 attr_accessor :api_domain, :api_endpoint, :api_key, :api_version, :auto_paginate, :client_id, :client_secret, :company_id, :connection_options, :debug, :default_media_type, :middleware, :no_retries, :per_page, :proxy, :read_token, :redirect_uri, :single_use_token, :single_use_token_algorithm, :single_use_token_company_id, :single_use_token_expiration_period, :single_use_token_private_key, :single_use_token_secret, :single_use_token_user_id, :ssl_verify_mode, :user_agent, :write_token |
#api_key ⇒ Object
Returns the value of attribute api_key.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def api_key @api_key end |
#api_version ⇒ Object
Returns the value of attribute api_version.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def api_version @api_version end |
#auto_paginate ⇒ Boolean
Returns Auto fetch next page of results until rate limit reached.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/booqable/configurable.rb', line 34 attr_accessor :api_domain, :api_endpoint, :api_key, :api_version, :auto_paginate, :client_id, :client_secret, :company_id, :connection_options, :debug, :default_media_type, :middleware, :no_retries, :per_page, :proxy, :read_token, :redirect_uri, :single_use_token, :single_use_token_algorithm, :single_use_token_company_id, :single_use_token_expiration_period, :single_use_token_private_key, :single_use_token_secret, :single_use_token_user_id, :ssl_verify_mode, :user_agent, :write_token |
#client_id ⇒ String
Returns Configure OAuth app key.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/booqable/configurable.rb', line 34 attr_accessor :api_domain, :api_endpoint, :api_key, :api_version, :auto_paginate, :client_id, :client_secret, :company_id, :connection_options, :debug, :default_media_type, :middleware, :no_retries, :per_page, :proxy, :read_token, :redirect_uri, :single_use_token, :single_use_token_algorithm, :single_use_token_company_id, :single_use_token_expiration_period, :single_use_token_private_key, :single_use_token_secret, :single_use_token_user_id, :ssl_verify_mode, :user_agent, :write_token |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def client_secret @client_secret end |
#company_id ⇒ Object
Returns the value of attribute company_id.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def company_id @company_id end |
#connection_options ⇒ Hash
Returns Configure connection options for Faraday.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/booqable/configurable.rb', line 34 attr_accessor :api_domain, :api_endpoint, :api_key, :api_version, :auto_paginate, :client_id, :client_secret, :company_id, :connection_options, :debug, :default_media_type, :middleware, :no_retries, :per_page, :proxy, :read_token, :redirect_uri, :single_use_token, :single_use_token_algorithm, :single_use_token_company_id, :single_use_token_expiration_period, :single_use_token_private_key, :single_use_token_secret, :single_use_token_user_id, :ssl_verify_mode, :user_agent, :write_token |
#debug ⇒ Object
Returns the value of attribute debug.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def debug @debug end |
#default_media_type ⇒ String
Returns Configure preferred media type (for API versioning, for example).
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/booqable/configurable.rb', line 34 attr_accessor :api_domain, :api_endpoint, :api_key, :api_version, :auto_paginate, :client_id, :client_secret, :company_id, :connection_options, :debug, :default_media_type, :middleware, :no_retries, :per_page, :proxy, :read_token, :redirect_uri, :single_use_token, :single_use_token_algorithm, :single_use_token_company_id, :single_use_token_expiration_period, :single_use_token_private_key, :single_use_token_secret, :single_use_token_user_id, :ssl_verify_mode, :user_agent, :write_token |
#middleware ⇒ Faraday::Builder or Faraday::RackBuilder
Returns Configure middleware for Faraday.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/booqable/configurable.rb', line 34 attr_accessor :api_domain, :api_endpoint, :api_key, :api_version, :auto_paginate, :client_id, :client_secret, :company_id, :connection_options, :debug, :default_media_type, :middleware, :no_retries, :per_page, :proxy, :read_token, :redirect_uri, :single_use_token, :single_use_token_algorithm, :single_use_token_company_id, :single_use_token_expiration_period, :single_use_token_private_key, :single_use_token_secret, :single_use_token_user_id, :ssl_verify_mode, :user_agent, :write_token |
#no_retries ⇒ Object
Returns the value of attribute no_retries.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def no_retries @no_retries end |
#per_page ⇒ String
Returns Configure page size for paginated results. API default: 25.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/booqable/configurable.rb', line 34 attr_accessor :api_domain, :api_endpoint, :api_key, :api_version, :auto_paginate, :client_id, :client_secret, :company_id, :connection_options, :debug, :default_media_type, :middleware, :no_retries, :per_page, :proxy, :read_token, :redirect_uri, :single_use_token, :single_use_token_algorithm, :single_use_token_company_id, :single_use_token_expiration_period, :single_use_token_private_key, :single_use_token_secret, :single_use_token_user_id, :ssl_verify_mode, :user_agent, :write_token |
#proxy ⇒ String
Returns URI for proxy server.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/booqable/configurable.rb', line 34 attr_accessor :api_domain, :api_endpoint, :api_key, :api_version, :auto_paginate, :client_id, :client_secret, :company_id, :connection_options, :debug, :default_media_type, :middleware, :no_retries, :per_page, :proxy, :read_token, :redirect_uri, :single_use_token, :single_use_token_algorithm, :single_use_token_company_id, :single_use_token_expiration_period, :single_use_token_private_key, :single_use_token_secret, :single_use_token_user_id, :ssl_verify_mode, :user_agent, :write_token |
#read_token ⇒ Object
Returns the value of attribute read_token.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def read_token @read_token end |
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def redirect_uri @redirect_uri end |
#single_use_token ⇒ Object
Returns the value of attribute single_use_token.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def single_use_token @single_use_token end |
#single_use_token_algorithm ⇒ Object
Returns the value of attribute single_use_token_algorithm.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def single_use_token_algorithm @single_use_token_algorithm end |
#single_use_token_company_id ⇒ Object
Returns the value of attribute single_use_token_company_id.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def single_use_token_company_id @single_use_token_company_id end |
#single_use_token_expiration_period ⇒ Object
Returns the value of attribute single_use_token_expiration_period.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def single_use_token_expiration_period @single_use_token_expiration_period end |
#single_use_token_private_key ⇒ Object
Returns the value of attribute single_use_token_private_key.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def single_use_token_private_key @single_use_token_private_key end |
#single_use_token_secret ⇒ Object
Returns the value of attribute single_use_token_secret.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def single_use_token_secret @single_use_token_secret end |
#single_use_token_user_id ⇒ Object
Returns the value of attribute single_use_token_user_id.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def single_use_token_user_id @single_use_token_user_id end |
#ssl_verify_mode ⇒ String
Returns SSL verify mode for ssl connections.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/booqable/configurable.rb', line 34 attr_accessor :api_domain, :api_endpoint, :api_key, :api_version, :auto_paginate, :client_id, :client_secret, :company_id, :connection_options, :debug, :default_media_type, :middleware, :no_retries, :per_page, :proxy, :read_token, :redirect_uri, :single_use_token, :single_use_token_algorithm, :single_use_token_company_id, :single_use_token_expiration_period, :single_use_token_private_key, :single_use_token_secret, :single_use_token_user_id, :ssl_verify_mode, :user_agent, :write_token |
#user_agent ⇒ String
Returns Configure User-Agent header for requests.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/booqable/configurable.rb', line 34 attr_accessor :api_domain, :api_endpoint, :api_key, :api_version, :auto_paginate, :client_id, :client_secret, :company_id, :connection_options, :debug, :default_media_type, :middleware, :no_retries, :per_page, :proxy, :read_token, :redirect_uri, :single_use_token, :single_use_token_algorithm, :single_use_token_company_id, :single_use_token_expiration_period, :single_use_token_private_key, :single_use_token_secret, :single_use_token_user_id, :ssl_verify_mode, :user_agent, :write_token |
#write_token ⇒ Object
Returns the value of attribute write_token.
34 35 36 |
# File 'lib/booqable/configurable.rb', line 34 def write_token @write_token end |
Class Method Details
.keys ⇒ Array
List of configurable keys for Booqable::Client
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/booqable/configurable.rb', line 65 def keys @keys ||= %i[ api_domain api_endpoint api_key api_version auto_paginate client_id client_secret company_id connection_options debug default_media_type middleware no_retries per_page proxy read_token redirect_uri single_use_token single_use_token_algorithm single_use_token_company_id single_use_token_expiration_period single_use_token_private_key single_use_token_secret single_use_token_user_id ssl_verify_mode user_agent write_token ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Set configuration options using a block
99 100 101 |
# File 'lib/booqable/configurable.rb', line 99 def configure yield self end |
#debug? ⇒ Boolean
Whether to print debug information
129 130 131 |
# File 'lib/booqable/configurable.rb', line 129 def debug? @debug || false end |
#reset! ⇒ Object Also known as: setup
Reset configuration options to default values
104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/booqable/configurable.rb', line 104 def reset! # rubocop:disable Style/HashEachMethods # # This may look like a `.keys.each` which should be replaced with `#each_key`, but # this doesn't actually work, since `#keys` is just a method we've defined ourselves. # The class doesn't fulfill the whole `Enumerable` contract. Booqable::Configurable.keys.each do |key| # rubocop:enable Style/HashEachMethods instance_variable_set(:"@#{key}", Booqable::Default.[key]) end self end |
#same_options?(opts) ⇒ Boolean
Compares client options to a Hash of requested options
122 123 124 |
# File 'lib/booqable/configurable.rb', line 122 def (opts) opts.hash == .hash end |