Class: Pushpad::Subscription::CountQuery
- Inherits:
-
Object
- Object
- Pushpad::Subscription::CountQuery
- Defined in:
- lib/pushpad/subscription.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ CountQuery
constructor
A new instance of CountQuery.
- #perform ⇒ Object
Constructor Details
#initialize(options) ⇒ CountQuery
Returns a new instance of CountQuery.
13 14 15 |
# File 'lib/pushpad/subscription.rb', line 13 def initialize() @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/pushpad/subscription.rb', line 11 def @options end |
Instance Method Details
#perform ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pushpad/subscription.rb', line 17 def perform project_id = [:project_id] || Pushpad.project_id raise "You must set project_id" unless project_id endpoint = "https://pushpad.xyz/api/v1/projects/#{project_id}/subscriptions" response = Request.head(endpoint, query_parameters: query_parameters) unless response.code == "200" raise CountError, "Response #{response.code} #{response.}: #{response.body}" end response["X-Total-Count"].to_i end |