Class: Patch::ProjectsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/patch_ruby/api/projects_api.rb

Constant Summary collapse

OPERATIONS =
[
  :retrieve_project,
  :retrieve_projects,
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ProjectsApi



24
25
26
# File 'lib/patch_ruby/api/projects_api.rb', line 24

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



22
23
24
# File 'lib/patch_ruby/api/projects_api.rb', line 22

def api_client
  @api_client
end

Instance Method Details

#retrieve_project(id, opts = {}) ⇒ ProjectResponse

Retrieves a project Retrieves a project available on Patch’s platform.

Options Hash (opts):

  • :accept_language (String)
  • :patch_version (Integer)


34
35
36
37
38
# File 'lib/patch_ruby/api/projects_api.rb', line 34

def retrieve_project(id, opts = {})

  data, _status_code, _headers = retrieve_project_with_http_info(id, opts)
  data
end

#retrieve_project_with_http_info(id, opts = {}) ⇒ Array<(ProjectResponse, Integer, Hash)>

Retrieves a project Retrieves a project available on Patch’s platform.

Options Hash (opts):

  • :accept_language (String)
  • :patch_version (Integer)


47
48
49
50
51
52
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
# File 'lib/patch_ruby/api/projects_api.rb', line 47

def retrieve_project_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectsApi.retrieve_project ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProjectsApi.retrieve_project"
  end
  # resource path
  local_var_path = '/v1/projects/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params['Patch-Version'] = 2
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?

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

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

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

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

  new_options = opts.merge(
    :operation => :"ProjectsApi.retrieve_project",
    :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: ProjectsApi#retrieve_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#retrieve_projects(opts = {}) ⇒ ProjectListResponse

Retrieves a list of projects Retrieves a list of projects available for purchase on Patch’s platform.

Options Hash (opts):

  • :page (Integer)
  • :country (String)
  • :type (String)
  • :minimum_available_mass (Integer)
  • :accept_language (String)
  • :patch_version (Integer)


109
110
111
112
113
# File 'lib/patch_ruby/api/projects_api.rb', line 109

def retrieve_projects(opts = {})

  data, _status_code, _headers = retrieve_projects_with_http_info(opts)
  data
end

#retrieve_projects_with_http_info(opts = {}) ⇒ Array<(ProjectListResponse, Integer, Hash)>

Retrieves a list of projects Retrieves a list of projects available for purchase on Patch’s platform.

Options Hash (opts):

  • :page (Integer)
  • :country (String)
  • :type (String)
  • :minimum_available_mass (Integer)
  • :accept_language (String)
  • :patch_version (Integer)


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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
# File 'lib/patch_ruby/api/projects_api.rb', line 125

def retrieve_projects_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectsApi.retrieve_projects ...'
  end
  # resource path
  local_var_path = '/v1/projects'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'minimum_available_mass'] = opts[:'minimum_available_mass'] if !opts[:'minimum_available_mass'].nil?

  # header parameters
  header_params = opts[:header_params] || {}

  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params['Patch-Version'] = 2
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?

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

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

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

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

  new_options = opts.merge(
    :operation => :"ProjectsApi.retrieve_projects",
    :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: ProjectsApi#retrieve_projects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end