wingrunr21 / mindbody-api

A Ruby interface to the MindBody API v0.5
http://wingrunr21.github.com/mindbody-api
MIT License
29 stars 46 forks source link

AppointmentService.get_bookable_items #24

Closed arvinkx closed 9 years ago

arvinkx commented 9 years ago

Hi, I'm not sure if this is expected behavior but it seems when using the get_bookable_items call it nests the parameter in "SessionTypeIDs," which seems to remove the ability to add Staff IDs, or Start and End Dates in with the call. For example:

MindBody::Services::AppointmentService.get_bookable_items(_Anything passed in here is nested inside tns:SessionTypeIDs_)

Therefore trying to call:

<Request>
                        <SourceCredentials>
                           <SourceName>{SourceName}</SourceName>
                           <Password>{Password}</Password>
                           <SiteIDs>
                              <int>{SiteID}</int>
                           </SiteIDs>
                        </SourceCredentials>
                        <SessionTypeIDs>
                           <int>2144979640</int>
                           <int>2144979641</int>
                        </SessionTypeIDs>
                        <LocationIDs>
                           <int>1</int>
                        </LocationIDs>
                        <StartDate>2010-11-19</StartDate>
                        <EndDate>2010-11-20</EndDate>
                        <StaffIDs>
                           <long>100000016</long>
                        </StaffIDs>
                     </Request>

Results in this:

<Request>
                        <SourceCredentials>
                           <SourceName>{SourceName}</SourceName>
                           <Password>{Password}</Password>
                           <SiteIDs>
                              <int>{SiteID}</int>
                           </SiteIDs>
                        </SourceCredentials>
                        <SessionTypeIDs>
                            <SessionTypeIDs>
                           <int>2144979640</int>
                           <int>2144979641</int>
                        </SessionTypeIDs>
                        <LocationIDs>
                           <int>1</int>
                        </LocationIDs>
                        <StartDate>2010-11-19</StartDate>
                        <EndDate>2010-11-20</EndDate>
                        <StaffIDs>
                           <long>100000016</long>
                        </StaffIDs>
                     </SessionTypeIDs>
                     </Request>

Is this the expected behavior and is there a different way of getting more parameters other than just SessionIDs in the API call?

wingrunr21 commented 9 years ago

SessionTypeIds is (or at least was) a requirement of this call. If you need to pass additional info, you have to pass a hash after the required arguments as documented here

arvinkx commented 9 years ago

Ah, I see now. I was adding a key to the required field just like the optional parameters, as well. Thanks.