Class: Nzbn::Client
- Inherits:
-
Object
- Object
- Nzbn::Client
- Defined in:
- lib/nzbn/client.rb
Overview
Main HTTP client for NZBN API
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
- #addresses ⇒ Object
- #company_details ⇒ Object
- #delete(path, params = {}, headers = {}) ⇒ Object
- #email_addresses ⇒ Object
-
#entities ⇒ Object
API Resource Accessors.
-
#get(path, params = {}, headers = {}) ⇒ Object
HTTP Methods.
- #history ⇒ Object
- #industry_classifications ⇒ Object
-
#initialize(api_key: nil, base_url: nil, timeout: nil) ⇒ Client
constructor
A new instance of Client.
- #organisation_parts ⇒ Object
- #patch(path, body = {}, headers = {}) ⇒ Object
- #phone_numbers ⇒ Object
- #post(path, body = {}, headers = {}) ⇒ Object
- #privacy_settings ⇒ Object
- #put(path, body = {}, headers = {}) ⇒ Object
- #roles ⇒ Object
- #trading_names ⇒ Object
- #watchlists ⇒ Object
- #websites ⇒ Object
Constructor Details
#initialize(api_key: nil, base_url: nil, timeout: nil) ⇒ Client
Returns a new instance of Client.
17 18 19 20 21 22 23 24 |
# File 'lib/nzbn/client.rb', line 17 def initialize(api_key: nil, base_url: nil, timeout: nil) @configuration = Nzbn.configuration&.dup || Configuration.new @configuration.api_key = api_key if api_key @configuration.base_url = base_url if base_url @configuration.timeout = timeout if timeout validate_configuration! end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
15 16 17 |
# File 'lib/nzbn/client.rb', line 15 def configuration @configuration end |
Instance Method Details
#addresses ⇒ Object
32 33 34 |
# File 'lib/nzbn/client.rb', line 32 def addresses @addresses ||= Api::Addresses.new(self) end |
#company_details ⇒ Object
64 65 66 |
# File 'lib/nzbn/client.rb', line 64 def company_details @company_details ||= Api::CompanyDetails.new(self) end |
#delete(path, params = {}, headers = {}) ⇒ Object
98 99 100 |
# File 'lib/nzbn/client.rb', line 98 def delete(path, params = {}, headers = {}) request(:delete, path, params, headers) end |
#email_addresses ⇒ Object
48 49 50 |
# File 'lib/nzbn/client.rb', line 48 def email_addresses @email_addresses ||= Api::EmailAddresses.new(self) end |
#entities ⇒ Object
API Resource Accessors
28 29 30 |
# File 'lib/nzbn/client.rb', line 28 def entities @entities ||= Api::Entities.new(self) end |
#get(path, params = {}, headers = {}) ⇒ Object
HTTP Methods
82 83 84 |
# File 'lib/nzbn/client.rb', line 82 def get(path, params = {}, headers = {}) request(:get, path, params, headers) end |
#history ⇒ Object
76 77 78 |
# File 'lib/nzbn/client.rb', line 76 def history @history ||= Api::History.new(self) end |
#industry_classifications ⇒ Object
56 57 58 |
# File 'lib/nzbn/client.rb', line 56 def industry_classifications @industry_classifications ||= Api::IndustryClassifications.new(self) end |
#organisation_parts ⇒ Object
72 73 74 |
# File 'lib/nzbn/client.rb', line 72 def organisation_parts @organisation_parts ||= Api::OrganisationParts.new(self) end |
#patch(path, body = {}, headers = {}) ⇒ Object
94 95 96 |
# File 'lib/nzbn/client.rb', line 94 def patch(path, body = {}, headers = {}) request(:patch, path, body, headers) end |
#phone_numbers ⇒ Object
44 45 46 |
# File 'lib/nzbn/client.rb', line 44 def phone_numbers @phone_numbers ||= Api::PhoneNumbers.new(self) end |
#post(path, body = {}, headers = {}) ⇒ Object
86 87 88 |
# File 'lib/nzbn/client.rb', line 86 def post(path, body = {}, headers = {}) request(:post, path, body, headers) end |
#privacy_settings ⇒ Object
60 61 62 |
# File 'lib/nzbn/client.rb', line 60 def privacy_settings @privacy_settings ||= Api::PrivacySettings.new(self) end |
#put(path, body = {}, headers = {}) ⇒ Object
90 91 92 |
# File 'lib/nzbn/client.rb', line 90 def put(path, body = {}, headers = {}) request(:put, path, body, headers) end |
#roles ⇒ Object
36 37 38 |
# File 'lib/nzbn/client.rb', line 36 def roles @roles ||= Api::Roles.new(self) end |
#trading_names ⇒ Object
40 41 42 |
# File 'lib/nzbn/client.rb', line 40 def trading_names @trading_names ||= Api::TradingNames.new(self) end |
#watchlists ⇒ Object
68 69 70 |
# File 'lib/nzbn/client.rb', line 68 def watchlists @watchlists ||= Api::Watchlists.new(self) end |