Class: ShopsavvyDataApi::UsagePeriod

Inherits:
Object
  • Object
show all
Defined in:
lib/shopsavvy_data_api/models.rb

Overview

Current billing period details

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ UsagePeriod

Returns a new instance of UsagePeriod.



293
294
295
296
297
298
299
300
# File 'lib/shopsavvy_data_api/models.rb', line 293

def initialize(data)
  @start_date = data["start_date"]
  @end_date = data["end_date"]
  @credits_used = data["credits_used"].to_i
  @credits_limit = data["credits_limit"].to_i
  @credits_remaining = data["credits_remaining"].to_i
  @requests_made = data["requests_made"].to_i
end

Instance Attribute Details

#credits_limitObject (readonly)

Returns the value of attribute credits_limit.



290
291
292
# File 'lib/shopsavvy_data_api/models.rb', line 290

def credits_limit
  @credits_limit
end

#credits_remainingObject (readonly)

Returns the value of attribute credits_remaining.



290
291
292
# File 'lib/shopsavvy_data_api/models.rb', line 290

def credits_remaining
  @credits_remaining
end

#credits_usedObject (readonly)

Returns the value of attribute credits_used.



290
291
292
# File 'lib/shopsavvy_data_api/models.rb', line 290

def credits_used
  @credits_used
end

#end_dateObject (readonly)

Returns the value of attribute end_date.



290
291
292
# File 'lib/shopsavvy_data_api/models.rb', line 290

def end_date
  @end_date
end

#requests_madeObject (readonly)

Returns the value of attribute requests_made.



290
291
292
# File 'lib/shopsavvy_data_api/models.rb', line 290

def requests_made
  @requests_made
end

#start_dateObject (readonly)

Returns the value of attribute start_date.



290
291
292
# File 'lib/shopsavvy_data_api/models.rb', line 290

def start_date
  @start_date
end

Instance Method Details

#to_hObject



302
303
304
305
306
307
308
309
310
311
# File 'lib/shopsavvy_data_api/models.rb', line 302

def to_h
  {
    start_date: start_date,
    end_date: end_date,
    credits_used: credits_used,
    credits_limit: credits_limit,
    credits_remaining: credits_remaining,
    requests_made: requests_made
  }
end