tiktok_business_api 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad55f88f2cd5e40133b2b5e9e50f531ab05d42c1481dbcb2bc10cce04e32b36c
4
- data.tar.gz: 1d9c0d9cd1d66d5f9b18ed7cafb300554f838d60fa8b3f1e674e6add14b51d16
3
+ metadata.gz: 2b75b59a548d691df5ead2efd45a9f7ea8bf1bd046f14cfd0286b3f564279041
4
+ data.tar.gz: 51cf8b92af0775d12cbc0f94aee289437b7ae3723b889933efe4b36a23dc9f00
5
5
  SHA512:
6
- metadata.gz: f62aad982847e47734da79d75d187819d67f518dbdc82232d2d85671bde0df713e022c930c544cb6a4976b21093f397d2aed810208deed395e1a16e846f70bac
7
- data.tar.gz: 136d73e3995bd71017e27579a5923b93c5e92141ae5828ee479d97a4eeaed835742919251c41d5f512a14e3b0311142a34f184c103d84eee2bdf113d47783e2c
6
+ metadata.gz: 5a956599241be58b694721840c447856d6ba58f0e16352309bd402eeafac0d6c5e70ffefc1c642122b3e6b0a716bc8a25ad2d3b92d952b72115c49868b90088c
7
+ data.tar.gz: 2efcfa2e2caf123b88a5c3d863812443a09ec59cb51da37618b4fe08f804b25d3448bf51bf41f4c53c7682f7b3c4fef6234a40a45a5b4ce66ff921dd5edcdfcc
@@ -13,7 +13,7 @@ module TiktokBusinessApi
13
13
  #
14
14
  # @param options [Hash] Override configuration options
15
15
  def initialize(options = {})
16
- @config = TiktokBusinessApi.config.dup
16
+ @config = TiktokBusinessApi.config.dup || Config.new
17
17
 
18
18
  # Override config with options
19
19
  options.each do |key, value|
@@ -41,7 +41,7 @@ module TiktokBusinessApi
41
41
  # @param params [Hash] Query parameters
42
42
  # @param headers [Hash] Custom headers
43
43
  # @return [Hash] Response data
44
- def get(path, params = {}, headers = {})
44
+ def _http_get(path, params = {}, headers = {})
45
45
  full_path = File.join(base_path, path)
46
46
  client.request(:get, full_path, params, headers)
47
47
  end
@@ -52,7 +52,7 @@ module TiktokBusinessApi
52
52
  # @param params [Hash] Body parameters
53
53
  # @param headers [Hash] Custom headers
54
54
  # @return [Hash] Response data
55
- def post(path, params = {}, headers = {})
55
+ def _http_post(path, params = {}, headers = {})
56
56
  full_path = File.join(base_path, path)
57
57
  client.request(:post, full_path, params, headers)
58
58
  end
@@ -12,11 +12,11 @@ module TiktokBusinessApi
12
12
  def create(advertiser_id, params = {})
13
13
  # Ensure advertiser_id is included in the params
14
14
  params = params.merge(advertiser_id: advertiser_id)
15
-
15
+
16
16
  response = post('create/', params)
17
17
  response['data']
18
18
  end
19
-
19
+
20
20
  # Get a list of campaigns
21
21
  #
22
22
  # @param advertiser_id [String] Advertiser ID
@@ -25,25 +25,11 @@ module TiktokBusinessApi
25
25
  def list(advertiser_id, params = {})
26
26
  # Ensure advertiser_id is included in the params
27
27
  params = params.merge(advertiser_id: advertiser_id)
28
-
29
- response = get('get/', params)
28
+
29
+ response = _http_get('get/', params)
30
30
  response['data']
31
31
  end
32
-
33
- # Get a list of campaigns with pagination support
34
- #
35
- # @param advertiser_id [String] Advertiser ID
36
- # @param params [Hash] Filter parameters
37
- # @yield [campaign] Block to process each campaign
38
- # @yieldparam campaign [Hash] Campaign from the response
39
- # @return [Array] All campaigns if no block is given
40
- def list_all(advertiser_id, params = {}, &block)
41
- # Ensure advertiser_id is included in the params
42
- params = params.merge(advertiser_id: advertiser_id)
43
-
44
- paginate('get/', params, {}, 'list')
45
- end
46
-
32
+
47
33
  # Get a campaign by ID
48
34
  #
49
35
  # @param advertiser_id [String] Advertiser ID
@@ -54,12 +40,12 @@ module TiktokBusinessApi
54
40
  advertiser_id: advertiser_id,
55
41
  campaign_ids: [campaign_id]
56
42
  }
57
-
58
- response = get('get/', params)
43
+
44
+ response = _http_get('get/', params)
59
45
  campaigns = response.dig('data', 'list') || []
60
46
  campaigns.first
61
47
  end
62
-
48
+
63
49
  # Update a campaign
64
50
  #
65
51
  # @param advertiser_id [String] Advertiser ID
@@ -72,11 +58,11 @@ module TiktokBusinessApi
72
58
  advertiser_id: advertiser_id,
73
59
  campaign_id: campaign_id
74
60
  )
75
-
76
- response = post('update/', params)
61
+
62
+ response = _http_post('update/', params)
77
63
  response['data']
78
64
  end
79
-
65
+
80
66
  # Update campaign status (enable/disable)
81
67
  #
82
68
  # @param advertiser_id [String] Advertiser ID
@@ -89,11 +75,11 @@ module TiktokBusinessApi
89
75
  campaign_ids: [campaign_id],
90
76
  operation_status: status
91
77
  }
92
-
78
+
93
79
  response = post('status/update/', params)
94
80
  response['data']
95
81
  end
96
-
82
+
97
83
  # Delete a campaign
98
84
  #
99
85
  # @param advertiser_id [String] Advertiser ID
@@ -104,8 +90,8 @@ module TiktokBusinessApi
104
90
  advertiser_id: advertiser_id,
105
91
  campaign_ids: [campaign_id]
106
92
  }
107
-
108
- response = post('delete/', params)
93
+
94
+ response = _http_post('delete/', params)
109
95
  response['data']
110
96
  end
111
97
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TiktokBusinessApi
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiktok_business_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - Your Name
7
+ - Vlad Zloteanu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
@@ -136,19 +136,16 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.9'
139
- description: A Ruby interface to the TikTok Business API with support for campaigns,
140
- ad groups, ads, and more
139
+ description: A Ruby interface to the TikTok Business API (Tiktok Ads API) with support
140
+ for campaigns, ad groups, ads, and more
141
141
  email:
142
- - your.email@example.com
142
+ - vlad.zloteanu@gmail.com
143
143
  executables: []
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
147
  - LICENSE.txt
148
148
  - README.md
149
- - bin/console
150
- - bin/publish_gem
151
- - lib/tiktok_ads_api.rb
152
149
  - lib/tiktok_business_api.rb
153
150
  - lib/tiktok_business_api/auth.rb
154
151
  - lib/tiktok_business_api/client.rb
@@ -157,7 +154,7 @@ files:
157
154
  - lib/tiktok_business_api/resources/base_resource.rb
158
155
  - lib/tiktok_business_api/resources/campaign.rb
159
156
  - lib/tiktok_business_api/version.rb
160
- homepage: https://github.com/yourusername/tiktok_business_api
157
+ homepage: https://github.com/vladzloteanu/tiktok_business_api
161
158
  licenses:
162
159
  - MIT
163
160
  metadata: {}
@@ -179,5 +176,5 @@ requirements: []
179
176
  rubygems_version: 3.4.19
180
177
  signing_key:
181
178
  specification_version: 4
182
- summary: Ruby client for the TikTok Business API
179
+ summary: Ruby client for the TikTok Business API / Tiktok Ads API
183
180
  test_files: []
data/bin/console DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "tiktok_business_api"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- require "irb"
11
- IRB.start(__FILE__)
data/bin/publish_gem DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -e
3
-
4
- # This script publishes the gem to RubyGems without requiring Git operations
5
-
6
- # Build the gem if needed
7
- if [ ! -f "pkg/tiktok_business_api-$(ruby -r ./lib/tiktok_business_api/version -e 'print TiktokBusinessApi::VERSION').gem" ]; then
8
- echo "Building gem..."
9
- bundle exec rake build
10
- fi
11
-
12
- # Get the current version
13
- CURRENT_VERSION=$(ruby -r ./lib/tiktok_business_api/version -e 'print TiktokBusinessApi::VERSION')
14
- echo "Publishing tiktok_business_api version $CURRENT_VERSION to RubyGems..."
15
-
16
- # Prompt for RubyGems credentials if needed
17
- if [ -z "$RUBYGEMS_API_KEY" ]; then
18
- if [ ! -f ~/.gem/credentials ]; then
19
- echo "RubyGems credentials not found. You need to log in to RubyGems."
20
- gem push --help
21
- read -p "Press Enter after you've set up your credentials..." _
22
- fi
23
- fi
24
-
25
- # Push to RubyGems
26
- echo "Pushing gem to RubyGems..."
27
- gem push "pkg/tiktok_business_api-$CURRENT_VERSION.gem"
28
-
29
- echo "Gem successfully published!"
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'faraday'
4
- require 'faraday/retry'
5
- require 'faraday/follow_redirects'
6
- require 'json'
7
-
8
- require_relative 'tiktok_ads_api/version'
9
- require_relative 'tiktok_ads_api/config'
10
- require_relative 'tiktok_ads_api/errors'
11
- require_relative 'tiktok_ads_api/client'
12
- require_relative 'tiktok_ads_api/auth'
13
-
14
- # Resources
15
- require_relative 'tiktok_ads_api/resources/base_resource'
16
- require_relative 'tiktok_ads_api/resources/campaign'
17
-
18
- module TiktokAdsApi
19
- class << self
20
- attr_accessor :config
21
-
22
- # Configure the TikTok Ads API client
23
- #
24
- # @yield [config] Configuration object that can be modified
25
- # @return [TiktokAdsApi::Config] The configuration object
26
- def configure
27
- self.config ||= Config.new
28
- yield(config) if block_given?
29
- config
30
- end
31
-
32
- # Create a new client instance
33
- #
34
- # @param options [Hash] Optional configuration overrides
35
- # @return [TiktokAdsApi::Client] A new client instance
36
- def client(options = {})
37
- TiktokAdsApi::Client.new(options)
38
- end
39
- end
40
- end