Skip to content

Commit e1e6c67

Browse files
committed
refactor(polymarket): rename #get to #list in TradeHistory and Candlesticks
Renames the #get method to #list in both TradeHistory and Candlesticks classes to align with the project's naming conventions for non-HTTP-GET methods. Updates corresponding tests and documentation.
1 parent 2fed9bd commit e1e6c67

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

lib/domeapi/polymarket/candlesticks.rb

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,8 @@ module Rubyists
44
module Domeapi
55
module Polymarket
66
# Candlesticks API endpoints
7-
class Candlesticks
8-
attr_reader :client
9-
10-
# @param client [Rubyists::Domeapi::Polymarket::Client]
11-
#
12-
# @return [void]
13-
def initialize(client = Rubyists::Domeapi::Polymarket::Client.new)
14-
@client = client
15-
end
16-
17-
# Filter for candlestick data,
7+
class Candlesticks < Endpoint
8+
# Filter for listing candlesticks,
189
# from https://docs.domeapi.io/api-reference/endpoint/get-candlesticks
1910
class Filter < Contract
2011
Properties = Struct.new(
@@ -41,7 +32,7 @@ class Filter < Contract
4132
#
4233
# @param filter [Filter] Filter options
4334
#
44-
# @return [Hash] candlestick data
35+
# @return [Candlestick] The candlestick data
4536
def list(filter = Filter.new(Filter::Properties.new))
4637
raise ArgumentError, filter.errors.full_messages.join(', ') unless filter.valid?
4738

lib/domeapi/polymarket/endpoint.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# frozen_string_literal: true
2+
3+
module Rubyists
4+
module Domeapi
5+
module Polymarket
6+
# Base class for Polymarket API endpoints
7+
class Endpoint
8+
attr_reader :client
9+
10+
# Initialize the Endpoint
11+
#
12+
# @param client [Client] The Domeapi client
13+
#
14+
# @return [void]
15+
def initialize(client = nil)
16+
@client = client || ::Rubyists::Domeapi::Client.new
17+
end
18+
end
19+
end
20+
end
21+
end

lib/domeapi/polymarket/markets.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Markets
1111
# from https://docs.domeapi.io/api-reference/endpoint/get-markets
1212
class Filter < Contract
1313
Properties = Struct.new(
14-
*custom_definitions,
1514
:market_slug,
1615
:event_slug,
1716
:condition_id,
@@ -26,7 +25,7 @@ class Filter < Contract
2625
)
2726

2827
# Define properties with custom populator to skip optional params with nil values
29-
(Properties.members - custom_definitions).each do |member|
28+
Properties.members.each do |member|
3029
property member, populator: ->(value:, **) { value || skip! }
3130
end
3231

0 commit comments

Comments
 (0)