Class: HiEnergyAi::Client
- Inherits:
-
Object
- Object
- HiEnergyAi::Client
- Defined in:
- lib/hi_energy_ai/client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #advertisers ⇒ Object
- #agencies ⇒ Object
- #app_get(path, params: {}) ⇒ Object
- #app_post(path, params: {}, body: nil) ⇒ Object
- #app_request(method, path, params: {}, body: nil) ⇒ Object
- #clicks ⇒ Object
- #contacts ⇒ Object
- #deals ⇒ Object
- #deeplinks ⇒ Object
- #delete(path, params: {}) ⇒ Object
- #domains ⇒ Object
- #exports ⇒ Object
- #get(path, params: {}) ⇒ Object
-
#initialize(api_key: nil, bearer_token: nil, base_url: nil, app_origin: nil, timeout: nil, user_agent: nil, dry_run: nil) ⇒ Client
constructor
A new instance of Client.
- #mcp ⇒ Object
- #networks ⇒ Object
- #opportunities ⇒ Object
- #paginate(path, params: {}) ⇒ Object
- #patch(path, params: {}, body: nil) ⇒ Object
- #post(path, params: {}, body: nil) ⇒ Object
- #publishers ⇒ Object
- #reports ⇒ Object
- #request(method, path, params: {}, body: nil) ⇒ Object
- #schema ⇒ Object
- #search ⇒ Object
- #status_changes ⇒ Object
- #tags ⇒ Object
- #tools ⇒ Object
- #transactions ⇒ Object
- #users ⇒ Object
- #verticals ⇒ Object
Constructor Details
#initialize(api_key: nil, bearer_token: nil, base_url: nil, app_origin: nil, timeout: nil, user_agent: nil, dry_run: nil) ⇒ Client
Returns a new instance of Client.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hi_energy_ai/client.rb', line 20 def initialize(api_key: nil, bearer_token: nil, base_url: nil, app_origin: nil, timeout: nil, user_agent: nil, dry_run: nil) @config = self.class.configuration.dup @config.api_key = api_key if api_key @config.bearer_token = bearer_token if bearer_token @config.base_url = base_url if base_url @config.app_origin = app_origin if app_origin @config.timeout = timeout if timeout @config.user_agent = user_agent if user_agent @config.dry_run = dry_run unless dry_run.nil? raise ArgumentError, "api_key or bearer_token is required" unless @config.credentials_present? end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/hi_energy_ai/client.rb', line 9 def config @config end |
Class Method Details
.configuration ⇒ Object
16 17 18 |
# File 'lib/hi_energy_ai/client.rb', line 16 def self.configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
11 12 13 14 |
# File 'lib/hi_energy_ai/client.rb', line 11 def self.configure yield(configuration) configuration end |
Instance Method Details
#advertisers ⇒ Object
81 82 83 |
# File 'lib/hi_energy_ai/client.rb', line 81 def advertisers @advertisers ||= Resources::Advertisers.new(self) end |
#agencies ⇒ Object
113 114 115 |
# File 'lib/hi_energy_ai/client.rb', line 113 def agencies @agencies ||= Resources::Agencies.new(self) end |
#app_get(path, params: {}) ⇒ Object
49 50 51 |
# File 'lib/hi_energy_ai/client.rb', line 49 def app_get(path, params: {}) app_request(:get, path, params: params) end |
#app_post(path, params: {}, body: nil) ⇒ Object
53 54 55 |
# File 'lib/hi_energy_ai/client.rb', line 53 def app_post(path, params: {}, body: nil) app_request(:post, path, params: params, body: body) end |
#app_request(method, path, params: {}, body: nil) ⇒ Object
61 62 63 |
# File 'lib/hi_energy_ai/client.rb', line 61 def app_request(method, path, params: {}, body: nil) perform_request(app_connection, method, path, params: params, body: body) end |
#clicks ⇒ Object
97 98 99 |
# File 'lib/hi_energy_ai/client.rb', line 97 def clicks @clicks ||= Resources::Clicks.new(self) end |
#contacts ⇒ Object
89 90 91 |
# File 'lib/hi_energy_ai/client.rb', line 89 def contacts @contacts ||= Resources::Contacts.new(self) end |
#deals ⇒ Object
85 86 87 |
# File 'lib/hi_energy_ai/client.rb', line 85 def deals @deals ||= Resources::Deals.new(self) end |
#deeplinks ⇒ Object
141 142 143 |
# File 'lib/hi_energy_ai/client.rb', line 141 def deeplinks @deeplinks ||= Resources::Deeplinks.new(self) end |
#delete(path, params: {}) ⇒ Object
45 46 47 |
# File 'lib/hi_energy_ai/client.rb', line 45 def delete(path, params: {}) request(:delete, path, params: params) end |
#domains ⇒ Object
137 138 139 |
# File 'lib/hi_energy_ai/client.rb', line 137 def domains @domains ||= Resources::Domains.new(self) end |
#exports ⇒ Object
145 146 147 |
# File 'lib/hi_energy_ai/client.rb', line 145 def exports @exports ||= Resources::Exports.new(self) end |
#get(path, params: {}) ⇒ Object
33 34 35 |
# File 'lib/hi_energy_ai/client.rb', line 33 def get(path, params: {}) request(:get, path, params: params) end |
#mcp ⇒ Object
149 150 151 |
# File 'lib/hi_energy_ai/client.rb', line 149 def mcp @mcp ||= Resources::Mcp.new(self) end |
#networks ⇒ Object
117 118 119 |
# File 'lib/hi_energy_ai/client.rb', line 117 def networks @networks ||= Resources::Networks.new(self) end |
#opportunities ⇒ Object
101 102 103 |
# File 'lib/hi_energy_ai/client.rb', line 101 def opportunities @opportunities ||= Resources::Opportunities.new(self) end |
#paginate(path, params: {}) ⇒ Object
65 66 67 |
# File 'lib/hi_energy_ai/client.rb', line 65 def paginate(path, params: {}) Paginator.new(client: self, path: path, params: params) end |
#patch(path, params: {}, body: nil) ⇒ Object
41 42 43 |
# File 'lib/hi_energy_ai/client.rb', line 41 def patch(path, params: {}, body: nil) request(:patch, path, params: params, body: body) end |
#post(path, params: {}, body: nil) ⇒ Object
37 38 39 |
# File 'lib/hi_energy_ai/client.rb', line 37 def post(path, params: {}, body: nil) request(:post, path, params: params, body: body) end |
#publishers ⇒ Object
109 110 111 |
# File 'lib/hi_energy_ai/client.rb', line 109 def publishers @publishers ||= Resources::Publishers.new(self) end |
#reports ⇒ Object
105 106 107 |
# File 'lib/hi_energy_ai/client.rb', line 105 def reports @reports ||= Resources::Reports.new(self) end |
#request(method, path, params: {}, body: nil) ⇒ Object
57 58 59 |
# File 'lib/hi_energy_ai/client.rb', line 57 def request(method, path, params: {}, body: nil) perform_request(api_connection, method, path, params: params, body: body) end |
#schema ⇒ Object
73 74 75 |
# File 'lib/hi_energy_ai/client.rb', line 73 def schema @schema ||= Resources::Schema.new(self) end |
#search ⇒ Object
77 78 79 |
# File 'lib/hi_energy_ai/client.rb', line 77 def search @search ||= Resources::Search.new(self) end |
#status_changes ⇒ Object
121 122 123 |
# File 'lib/hi_energy_ai/client.rb', line 121 def status_changes @status_changes ||= Resources::StatusChanges.new(self) end |
#tags ⇒ Object
125 126 127 |
# File 'lib/hi_energy_ai/client.rb', line 125 def @tags ||= Resources::Tags.new(self) end |
#tools ⇒ Object
69 70 71 |
# File 'lib/hi_energy_ai/client.rb', line 69 def tools @tools ||= Resources::Tools.new(self) end |
#transactions ⇒ Object
93 94 95 |
# File 'lib/hi_energy_ai/client.rb', line 93 def transactions @transactions ||= Resources::Transactions.new(self) end |