Class: XbimComms::ContactsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/xbim_comms/api/contacts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ContactsApi

Returns a new instance of ContactsApi.



19
20
21
# File 'lib/xbim_comms/api/contacts_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/xbim_comms/api/contacts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#contacts_search(term, region, opts = {}) ⇒ ContactList

Get Contacts search <span style=‘font-size: 17px;’>Summary:</span>Return Type: ContactList<br/><br/>

Parameters:

  • term (String)
  • region (String)

    The data center region the data resides in

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :expand (String)
  • :filter (String)
  • :select (String)
  • :orderby (String)
  • :top (Integer)
  • :skip (Integer)
  • :count (Boolean)

Returns:



35
36
37
38
# File 'lib/xbim_comms/api/contacts_api.rb', line 35

def contacts_search(term, region, opts = {})
  data, _status_code, _headers = contacts_search_with_http_info(term, region, opts)
  data
end

#contacts_search_with_http_info(term, region, opts = {}) ⇒ Array<(ContactList, Integer, Hash)>

Get Contacts search &lt;span style&#x3D;&#39;font-size: 17px;&#39;&gt;Summary:&lt;/span&gt;Return Type: &lt;b&gt;ContactList&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;

Parameters:

  • term (String)
  • region (String)

    The data center region the data resides in

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :expand (String)
  • :filter (String)
  • :select (String)
  • :orderby (String)
  • :top (Integer)
  • :skip (Integer)
  • :count (Boolean)

Returns:

  • (Array<(ContactList, Integer, Hash)>)

    ContactList data, response status code and response headers



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/xbim_comms/api/contacts_api.rb', line 53

def contacts_search_with_http_info(term, region, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.contacts_search ...'
  end
  # verify the required parameter 'term' is set
  if @api_client.config.client_side_validation && term.nil?
    fail ArgumentError, "Missing the required parameter 'term' when calling ContactsApi.contacts_search"
  end
  # verify the required parameter 'region' is set
  if @api_client.config.client_side_validation && region.nil?
    fail ArgumentError, "Missing the required parameter 'region' when calling ContactsApi.contacts_search"
  end
  # verify enum value
  allowable_values = ["UK", "WestEurope", "Sandbox"]
  if @api_client.config.client_side_validation && !allowable_values.include?(region)
    fail ArgumentError, "invalid value for \"region\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/{region}/comms/2.0/Contacts/Search(Term={term})'.sub('{' + 'term' + '}', CGI.escape(term.to_s)).sub('{' + 'region' + '}', CGI.escape(region.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?
  query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?
  query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?
  query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?
  query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?
  query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/json;odata.metadata=none', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ContactList'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"ContactsApi.contacts_search",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#contacts_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contacts(region, opts = {}) ⇒ ContactList

Get Contacts <span style=‘font-size: 17px;’>Summary:</span>Return Type: ContactList<br/><br/>

Parameters:

  • region (String)

    The data center region the data resides in

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :expand (String)
  • :filter (String)
  • :select (String)
  • :orderby (String)
  • :top (Integer)
  • :skip (Integer)
  • :count (Boolean)

Returns:



129
130
131
132
# File 'lib/xbim_comms/api/contacts_api.rb', line 129

def get_contacts(region, opts = {})
  data, _status_code, _headers = get_contacts_with_http_info(region, opts)
  data
end

#get_contacts_with_http_info(region, opts = {}) ⇒ Array<(ContactList, Integer, Hash)>

Get Contacts &lt;span style&#x3D;&#39;font-size: 17px;&#39;&gt;Summary:&lt;/span&gt;Return Type: &lt;b&gt;ContactList&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;

Parameters:

  • region (String)

    The data center region the data resides in

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :expand (String)
  • :filter (String)
  • :select (String)
  • :orderby (String)
  • :top (Integer)
  • :skip (Integer)
  • :count (Boolean)

Returns:

  • (Array<(ContactList, Integer, Hash)>)

    ContactList data, response status code and response headers



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/xbim_comms/api/contacts_api.rb', line 146

def get_contacts_with_http_info(region, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.get_contacts ...'
  end
  # verify the required parameter 'region' is set
  if @api_client.config.client_side_validation && region.nil?
    fail ArgumentError, "Missing the required parameter 'region' when calling ContactsApi.get_contacts"
  end
  # verify enum value
  allowable_values = ["UK", "WestEurope", "Sandbox"]
  if @api_client.config.client_side_validation && !allowable_values.include?(region)
    fail ArgumentError, "invalid value for \"region\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/{region}/comms/2.0/Contacts'.sub('{' + 'region' + '}', CGI.escape(region.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?
  query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?
  query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?
  query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?
  query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?
  query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/json;odata.metadata=none', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ContactList'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"ContactsApi.get_contacts",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end