Skip to content

Commit

Permalink
Merge pull request #13 from alexagranov/v0.1.2
Browse files Browse the repository at this point in the history
adding :resource_id and :service_id to Booking item response [finishe…
  • Loading branch information
alexagranov authored Jun 15, 2017
2 parents efeaf07 + 3c047c4 commit 8843747
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file.

## [0.1.2] - 2017-06-14 ##
### Changed
- [#13](https://github.com/gonebusy/gonebusy-nodejs-client/pull/13) - Booking item response now includes :resource_id and :service_id corresponding to Resource providing the Booking and the Service being performed.

## [0.1.1] - 2017-05-25 ##
### Changed
- [#12](https://github.com/gonebusy/gonebusy-nodejs-client/pull/12) - POST /bookings/new :user_id is now a required parameter.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This client library is a Ruby gem which can be compiled and used in your Ruby an

1. Open the command line interface or the terminal and navigate to the folder containing the source code.
2. Run ``` gem build gonebusy.gemspec ``` to build the gem.
3. Once built, the gem can be installed on the current work environment using ``` gem install gonebusy-0.1.1.gem ```
3. Once built, the gem can be installed on the current work environment using ``` gem install gonebusy-0.1.2.gem ```

## How to Use

Expand Down
2 changes: 1 addition & 1 deletion gonebusy-ruby-client.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'gonebusy-ruby-client'
s.version = '0.1.1'
s.version = '0.1.2'
s.summary = 'GoneBusy API Ruby client'
s.description = 'This is a Ruby client for communicating with the full GoneBusy API'
s.authors = ["Alex Agranov"]
Expand Down
22 changes: 20 additions & 2 deletions lib/gonebusy/models/entities_booking_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ class EntitiesBookingResponse < BaseModel
# @return [EntitiesTimeWindowResponse]
attr_accessor :time_window

# id of Resource performing Booking
# @return [Integer]
attr_accessor :resource_id

# id of Service booked
# @return [Integer]
attr_accessor :service_id

# A mapping from model property names to API property names
def self.names
if @_hash.nil?
Expand All @@ -31,6 +39,8 @@ def self.names
@_hash["workflow_state"] = "workflow_state"
@_hash["user_message"] = "user_message"
@_hash["time_window"] = "time_window"
@_hash["resource_id"] = "resource_id"
@_hash["service_id"] = "service_id"
end
@_hash
end
Expand All @@ -39,12 +49,16 @@ def initialize(id = nil,
owner_id = nil,
workflow_state = nil,
user_message = nil,
time_window = nil)
time_window = nil,
resource_id = nil,
service_id = nil)
@id = id
@owner_id = owner_id
@workflow_state = workflow_state
@user_message = user_message
@time_window = time_window
@resource_id = resource_id
@service_id = service_id
end

# Creates an instance of the object from a hash
Expand All @@ -57,13 +71,17 @@ def self.from_hash(hash)
workflow_state = hash['workflow_state']
user_message = hash['user_message']
time_window = EntitiesTimeWindowResponse.from_hash(hash['time_window']) if hash['time_window']
resource_id = hash['resource_id']
service_id = hash['service_id']

# Create object from extracted values
EntitiesBookingResponse.new(id,
owner_id,
workflow_state,
user_message,
time_window)
time_window,
resource_id,
service_id)
end
end
end

0 comments on commit 8843747

Please sign in to comment.