Class: Alman::Booking

Inherits:
ApiResource show all
Defined in:
lib/alman/resources/booking.rb

Instance Attribute Summary collapse

Attributes inherited from ApiResource

#api_method, #client, #json

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiResource

add_api_attribute, api_attribute_names, #api_attributes, api_subclass_fetch, api_subclasses, #changed_api_attributes, #clear_api_attributes, client, #determine_api_attribute_value, determine_api_attribute_value, #initialize, #inspect, #inspect_api_attributes, #inspect_nested, #refresh_from, register_api_subclass, #to_json

Constructor Details

This class inherits a constructor from Alman::ApiResource

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/alman/resources/booking.rb', line 3

def created_at
  @created_at
end

#created_at_rfc822Object

Returns the value of attribute created_at_rfc822.



4
5
6
# File 'lib/alman/resources/booking.rb', line 4

def created_at_rfc822
  @created_at_rfc822
end

#end_atObject

Returns the value of attribute end_at.



5
6
7
# File 'lib/alman/resources/booking.rb', line 5

def end_at
  @end_at
end

#end_at_rfc822Object

Returns the value of attribute end_at_rfc822.



6
7
8
# File 'lib/alman/resources/booking.rb', line 6

def end_at_rfc822
  @end_at_rfc822
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/alman/resources/booking.rb', line 7

def id
  @id
end

#metaObject

Returns the value of attribute meta.



8
9
10
# File 'lib/alman/resources/booking.rb', line 8

def meta
  @meta
end

#objectObject

Returns the value of attribute object.



9
10
11
# File 'lib/alman/resources/booking.rb', line 9

def object
  @object
end

#start_atObject

Returns the value of attribute start_at.



10
11
12
# File 'lib/alman/resources/booking.rb', line 10

def start_at
  @start_at
end

#start_at_rfc822Object

Returns the value of attribute start_at_rfc822.



11
12
13
# File 'lib/alman/resources/booking.rb', line 11

def start_at_rfc822
  @start_at_rfc822
end

#updated_atObject

Returns the value of attribute updated_at.



12
13
14
# File 'lib/alman/resources/booking.rb', line 12

def updated_at
  @updated_at
end

#updated_at_rfc822Object

Returns the value of attribute updated_at_rfc822.



13
14
15
# File 'lib/alman/resources/booking.rb', line 13

def updated_at_rfc822
  @updated_at_rfc822
end

Class Method Details

.all(params = {}, headers = {}) ⇒ Object



15
16
17
18
# File 'lib/alman/resources/booking.rb', line 15

def self.all(params={}, headers={})
  res = client.bookings.all(params, headers)
  res
end

.retrieve(booking_id, params = {}, headers = {}) ⇒ Object



20
21
22
23
# File 'lib/alman/resources/booking.rb', line 20

def self.retrieve(booking_id, params={}, headers={})
  res = client.bookings.retrieve(booking_id, params, headers)
  res
end

.update(booking_id, params = {}, headers = {}) ⇒ Object



25
26
27
28
# File 'lib/alman/resources/booking.rb', line 25

def self.update(booking_id, params={}, headers={})
  res = client.bookings.update(booking_id, params, headers)
  res
end

Instance Method Details

#delete(params = {}, headers = {}) ⇒ Object



35
36
37
38
# File 'lib/alman/resources/booking.rb', line 35

def delete(params={}, headers={})
  res = client.bookings.delete(id, params, headers)
  self.refresh_from(res.json, res.api_method, res.client)
end

#refresh(params = {}, headers = {}) ⇒ Object



30
31
32
33
# File 'lib/alman/resources/booking.rb', line 30

def refresh(params={}, headers={})
  res = client.bookings.retrieve(id, params, headers)
  self.refresh_from(res.json, res.api_method, res.client)
end

#save(params = {}, headers = {}) ⇒ Object



40
41
42
43
44
# File 'lib/alman/resources/booking.rb', line 40

def save(params={}, headers={})
  params = ParamsBuilder.merge(api_attributes, params)
  res = client.bookings.update(id, params, headers)
  self.refresh_from(res.json, res.api_method, res.client)
end