Class: Vng::Lock
Overview
Provides methods to interact with Vonigo locks.
Constant Summary collapse
- PATH =
 '/api/v1/resources/availability/'
Instance Attribute Summary collapse
- 
  
    
      #id  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute id.
 
Class Method Summary collapse
Instance Method Summary collapse
- 
  
    
      #initialize(id:)  ⇒ Lock 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Lock.
 
Constructor Details
#initialize(id:) ⇒ Lock
Returns a new instance of Lock.
      10 11 12  | 
    
      # File 'lib/vng/lock.rb', line 10 def initialize(id:) @id = id end  | 
  
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
      8 9 10  | 
    
      # File 'lib/vng/lock.rb', line 8 def id @id end  | 
  
Class Method Details
.create(duration:, location_id:, date:, minutes:, route_id:) ⇒ Object
      14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  | 
    
      # File 'lib/vng/lock.rb', line 14 def self.create(duration:, location_id:, date:, minutes:, route_id:) body = { method: '2', serviceTypeID: '14', # only create items of serviceType 'Pet Grooming' duration: [duration.to_i, 30].max, # or 'duration is not supplied' locationID: location_id, dayID: date.strftime('%Y%m%d'), routeID: route_id, startTime: minutes, } data = request path: Vng::Availability::PATH, body: body new id: data['Ids']['lockID'] end  |