ax-track 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c016c0f8b6b21a305c193d350b3a1bf003bc4022da5116c56eb9eb46bd87689
4
- data.tar.gz: fb56d8a6ad760e23c4d90d513d28d1bc46a06832cc8fe25e18e0332556021fac
3
+ metadata.gz: a2435c9350d10dfb406b2c3f0c1a4db35de9029465e7b31622407a0a580722d4
4
+ data.tar.gz: 803333823277c76dd4532382c409d5c4dbe5b1ad10070626005da7ff9f3c0552
5
5
  SHA512:
6
- metadata.gz: '02385bde367ee4eb289955f65e8516d9e0b548ba4e5539d6da4bd1838307c99fdcc1940f6fa53460887ddb821fb95939b4fe8de224627cd0c6ecc4b148eecd69'
7
- data.tar.gz: ec3105555b83b46efecf619c04794e9e7873620fffaa82d7574d6a309b32949e93c84f929714687ca17b7cf798c920e54ed3f3d2c46b3cc4caf941fe509e00f8
6
+ metadata.gz: b194b85b47d4eea1f300ef5a2d579f3029abce9bfc03920c859c2d1e25769859e5a608d150847fdb276a4142186b19730bbcd279865197b7c6356b2ec4b0c5ca
7
+ data.tar.gz: 5ebdfac60f867abc3a6dd92f4584c22411acc1eed1427ccd26b15d3727f7bae53635e8c406c9f39589f3a8a1638fa7d996ba3afbc777a2f3f07af2ec69120b0d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ax-track (0.1.14)
4
+ ax-track (0.1.15)
5
5
  faraday (~> 1.7)
6
6
  faraday_middleware (~> 1.1)
7
7
 
@@ -12,9 +12,10 @@ module AxTrack
12
12
  APIKeyMissing = Class.new(StandardError)
13
13
 
14
14
  attr_reader :api_key, :adapter
15
- def initialize(api_key: ENV['AXTRACK_API_KEY'], adapter: Faraday.default_adapter)
16
- @api_key = api_key
17
- @adapter = adapter
15
+ def initialize(api_key: nil, adapter: nil, stubs: nil)
16
+ @api_key = api_key || ENV['AXTRACK_API_KEY']
17
+ @adapter = adapter || Faraday.default_adapter
18
+ @stubs = stubs
18
19
 
19
20
  raise APIKeyMissing, "No API key provided" if !defined?(api_key) || api_key.nil? || api_key.empty?
20
21
  end
@@ -33,7 +34,7 @@ module AxTrack
33
34
  #conn.request :url_encoded
34
35
  conn.request :json
35
36
  conn.response :json, content_type: 'application/json'
36
- conn.adapter Faraday.default_adapter
37
+ conn.adapter adapter, @stubs
37
38
  conn.headers['Authorization'] = "Token #{api_key}" unless api_key.empty?
38
39
  end
39
40
  end
@@ -6,15 +6,13 @@ module AxTrack
6
6
  # type is the class Type to wrap the results from key
7
7
  def self.from_response(json_response, key:, type: )
8
8
  body = json_response.body
9
- new(
10
- data: body[key].map { |attrs| type.new(attrs ) },
11
- total: body.dig('count'),
12
- next_cursor: body.dig('next'),
13
- prev_cursor: body.dig('previous')
14
- )
9
+ new(data: body[key].map { |attrs| type.new(attrs ) },
10
+ total: body.dig('count'),
11
+ next_cursor: body.dig('next'),
12
+ prev_cursor: body.dig('previous'))
15
13
  end
16
14
 
17
- def initialize (data:, total:, next_cursor:, prev_cursor:)
15
+ def initialize(data:, total:, next_cursor:, prev_cursor:)
18
16
  @data = data
19
17
  @total = total
20
18
  @next_cursor = next_cursor.nil? || next_cursor.empty? ? nil : next_cursor
@@ -8,9 +8,6 @@ module AxTrack
8
8
  def create_getters(required_getter_methods = instance_variables.map { |attr_name| attr_name[1..-1 ]})
9
9
  required_getter_methods.each do |attr|
10
10
  singleton_class.send :attr_reader, attr unless self.respond_to? attr
11
- # define_singleton_method(v.to_s.tr('@','')) do
12
- # instance_variable_get(v)
13
- # end
14
11
  end
15
12
  end
16
13
 
@@ -10,7 +10,6 @@ module AxTrack
10
10
  ApiRequestsQuotaReachedError = Class.new(ApiError)
11
11
  NotFoundError = Class.new(ApiError)
12
12
  UnprocessableEntityError = Class.new(ApiError)
13
- ApiError = Class.new(ApiError)
14
13
 
15
14
  HTTP_OK_CODE = 200
16
15
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AxTrack
4
- VERSION = "0.1.14"
4
+ VERSION = "0.1.15"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ax-track
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Baumann
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-07 00:00:00.000000000 Z
11
+ date: 2021-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday