Class: BillForward::PeriodsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/bf_ruby2/api/periods_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PeriodsApi

Returns a new instance of PeriodsApi.



30
31
32
# File 'lib/bf_ruby2/api/periods_api.rb', line 30

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



28
29
30
# File 'lib/bf_ruby2/api/periods_api.rb', line 28

def api_client
  @api_client
end

Instance Method Details

#get_all_periods_for_subscription(subscription_id, opts = {}) ⇒ PeriodPagedMetadata

Retrieve by subscription) { "nickname" : "Retrieve by subscription","response" : "getPeriodsForSubscription.html"}

Parameters:

  • subscription_id

    The subscriptionID of the usage.

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

  • :offset (Integer)

    The offset from the first amendment to return. (default to 0)

  • :records (Integer)

    The maximum number of amendments to return. (default to 8766)

  • :order_by (String)

    Specify a field used to order the result set. (default to created)

  • :order (String)

    The direction of any ordering, either ASC or DESC. (default to ASC)

Returns:



44
45
46
47
# File 'lib/bf_ruby2/api/periods_api.rb', line 44

def get_all_periods_for_subscription(subscription_id, opts = {})
  data, _status_code, _headers = get_all_periods_for_subscription_with_http_info(subscription_id, opts)
  return data
end

#get_all_periods_for_subscription_with_http_info(subscription_id, opts = {}) ⇒ Array<(PeriodPagedMetadata, Fixnum, Hash)>

Retrieve by subscription) { &quot;nickname&quot; : &quot;Retrieve by subscription&quot;,&quot;response&quot; : &quot;getPeriodsForSubscription.html&quot;}

Parameters:

  • subscription_id

    The subscriptionID of the usage.

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

  • :offset (Integer)

    The offset from the first amendment to return.

  • :records (Integer)

    The maximum number of amendments to return.

  • :order_by (String)

    Specify a field used to order the result set.

  • :order (String)

    The direction of any ordering, either ASC or DESC.

Returns:

  • (Array<(PeriodPagedMetadata, Fixnum, Hash)>)

    PeriodPagedMetadata data, response status code and response headers



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
# File 'lib/bf_ruby2/api/periods_api.rb', line 59

def get_all_periods_for_subscription_with_http_info(subscription_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: PeriodsApi.get_all_periods_for_subscription ..."
  end
  # verify the required parameter 'subscription_id' is set
  fail ArgumentError, "Missing the required parameter 'subscription_id' when calling PeriodsApi.get_all_periods_for_subscription" if subscription_id.nil?
  if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC'
  end
  # resource path
  local_var_path = "/periods/{subscription-id}".sub('{format}','json').sub('{' + 'subscription-id' + '}', subscription_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PeriodPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PeriodsApi#get_all_periods_for_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_latest_periods(opts = {}) ⇒ PeriodPagedMetadata

Get all periods { "nickname" : "Get all periods","response" : "getPeriods.html"}

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

  • :offset (Integer)

    The offset from the first amendment to return. (default to 0)

  • :records (Integer)

    The maximum number of amendments to return. (default to 8766)

  • :order_by (String)

    Specify a field used to order the result set. (default to created)

  • :order (String)

    The direction of any ordering, either ASC or DESC. (default to ASC)

Returns:



118
119
120
121
# File 'lib/bf_ruby2/api/periods_api.rb', line 118

def get_latest_periods(opts = {})
  data, _status_code, _headers = get_latest_periods_with_http_info(opts)
  return data
end

#get_latest_periods_with_http_info(opts = {}) ⇒ Array<(PeriodPagedMetadata, Fixnum, Hash)>

Get all periods { &quot;nickname&quot; : &quot;Get all periods&quot;,&quot;response&quot; : &quot;getPeriods.html&quot;}

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

  • :offset (Integer)

    The offset from the first amendment to return.

  • :records (Integer)

    The maximum number of amendments to return.

  • :order_by (String)

    Specify a field used to order the result set.

  • :order (String)

    The direction of any ordering, either ASC or DESC.

Returns:

  • (Array<(PeriodPagedMetadata, Fixnum, Hash)>)

    PeriodPagedMetadata data, response status code and response headers



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
176
177
178
# File 'lib/bf_ruby2/api/periods_api.rb', line 132

def get_latest_periods_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: PeriodsApi.get_latest_periods ..."
  end
  if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC'
  end
  # resource path
  local_var_path = "/periods".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PeriodPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PeriodsApi#get_latest_periods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end