Class: XapiScraper::Client
- Inherits:
-
Object
- Object
- XapiScraper::Client
- Extended by:
- T::Sig
- Defined in:
- lib/xapi_scraper/client.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#analysis ⇒ Object
Returns the value of attribute analysis.
-
#articles ⇒ Object
Returns the value of attribute articles.
-
#communities ⇒ Object
Returns the value of attribute communities.
-
#dm ⇒ Object
Returns the value of attribute dm.
-
#lists ⇒ Object
Returns the value of attribute lists.
-
#search ⇒ Object
Returns the value of attribute search.
-
#timelines ⇒ Object
Returns the value of attribute timelines.
-
#trending ⇒ Object
Returns the value of attribute trending.
-
#tweets ⇒ Object
Returns the value of attribute tweets.
-
#users ⇒ Object
Returns the value of attribute users.
Instance Method Summary collapse
- #get_url(base_url:, url_variables: nil) ⇒ Object
- #init_sdks ⇒ Object
-
#initialize(client: nil, retry_config: nil, timeout_ms: nil, bearer_auth: nil, security_source: nil, server: nil, server_url: nil, url_params: nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(client: nil, retry_config: nil, timeout_ms: nil, bearer_auth: nil, security_source: nil, server: nil, server_url: nil, url_params: nil) ⇒ Client
Returns a new instance of Client.
57 58 59 60 61 62 63 64 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 96 97 98 99 100 |
# File 'lib/xapi_scraper/client.rb', line 57 def initialize( client: nil, retry_config: nil, timeout_ms: nil, bearer_auth: nil, security_source: nil, server: nil, server_url: nil, url_params: nil ) = { request: { params_encoder: Faraday::FlatParamsEncoder } } [:request][:timeout] = (timeout_ms.to_f / 1000) unless timeout_ms.nil? client ||= Faraday.new(**) do |f| f.request(:multipart, {flat_encode: true}) # f.response :logger, nil, { headers: true, bodies: true, errors: true } end if !server_url.nil? if !url_params.nil? server_url = Utils.template_url(server_url, url_params) end end raise StandardError, "Invalid server \"#{server}\"" if !server.nil? && !SERVERS.key?(server) hooks = SDKHooks::Hooks.new @sdk_configuration = SDKConfiguration.new( client, hooks, retry_config, timeout_ms, bearer_auth, security_source, server_url, server ) @sdk_configuration = hooks.sdk_init(config: @sdk_configuration) init_sdks end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def account @account end |
#analysis ⇒ Object
Returns the value of attribute analysis.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def analysis @analysis end |
#articles ⇒ Object
Returns the value of attribute articles.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def articles @articles end |
#communities ⇒ Object
Returns the value of attribute communities.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def communities @communities end |
#dm ⇒ Object
Returns the value of attribute dm.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def dm @dm end |
#lists ⇒ Object
Returns the value of attribute lists.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def lists @lists end |
#search ⇒ Object
Returns the value of attribute search.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def search @search end |
#timelines ⇒ Object
Returns the value of attribute timelines.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def timelines @timelines end |
#trending ⇒ Object
Returns the value of attribute trending.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def trending @trending end |
#tweets ⇒ Object
Returns the value of attribute tweets.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def tweets @tweets end |
#users ⇒ Object
Returns the value of attribute users.
20 21 22 |
# File 'lib/xapi_scraper/client.rb', line 20 def users @users end |
Instance Method Details
#get_url(base_url:, url_variables: nil) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/xapi_scraper/client.rb', line 118 def get_url(base_url:, url_variables: nil) sd_base_url, = @sdk_configuration.get_server_details if base_url.nil? base_url = sd_base_url end if url_variables.nil? url_variables = end return Utils.template_url(base_url, url_variables) end |
#init_sdks ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/xapi_scraper/client.rb', line 103 def init_sdks @search = Search.new(@sdk_configuration) @tweets = Tweets.new(@sdk_configuration) @users = Users.new(@sdk_configuration) @analysis = Analysis.new(@sdk_configuration) @dm = Dm.new(@sdk_configuration) @articles = Articles.new(@sdk_configuration) @communities = Communities.new(@sdk_configuration) @lists = Lists.new(@sdk_configuration) @trending = Trending.new(@sdk_configuration) @timelines = Timelines.new(@sdk_configuration) @account = Account.new(@sdk_configuration) end |