File tree Expand file tree Collapse file tree 3 files changed +25
-14
lines changed
Expand file tree Collapse file tree 3 files changed +25
-14
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments