Class: Ecoportal::API::V2
- Inherits:
-
Object
- Object
- Ecoportal::API::V2
- Extended by:
- Common::BaseClass
- Includes:
- Common::Logging
- Defined in:
- lib/ecoportal/api/v2.rb,
lib/ecoportal/api/v2/s3.rb,
lib/ecoportal/api/v2/page.rb,
lib/ecoportal/api/v2/pages.rb,
lib/ecoportal/api/v2/people.rb,
lib/ecoportal/api/v2/s3/data.rb,
lib/ecoportal/api/v2/s3/files.rb,
lib/ecoportal/api/v2/registers.rb,
lib/ecoportal/api/v2/s3/upload.rb,
lib/ecoportal/api/v2/page/force.rb,
lib/ecoportal/api/v2/page/stage.rb,
lib/ecoportal/api/v2/page/forces.rb,
lib/ecoportal/api/v2/page/permit.rb,
lib/ecoportal/api/v2/page/stages.rb,
lib/ecoportal/api/v2/page/section.rb,
lib/ecoportal/api/v2/pages/stages.rb,
lib/ecoportal/api/v2/page/sections.rb,
lib/ecoportal/api/v2/s3/files/poll.rb,
lib/ecoportal/api/v2/page/component.rb,
lib/ecoportal/api/v2/page/components.rb,
lib/ecoportal/api/v2/pages/page_stage.rb,
lib/ecoportal/api/v2/page/force/helper.rb,
lib/ecoportal/api/v2/page/component/law.rb,
lib/ecoportal/api/v2/page/force/binding.rb,
lib/ecoportal/api/v2/page/mould_counter.rb,
lib/ecoportal/api/v2/registers/register.rb,
lib/ecoportal/api/v2/registers/template.rb,
lib/ecoportal/api/v2/page/component/file.rb,
lib/ecoportal/api/v2/page/force/bindings.rb,
lib/ecoportal/api/v2/page/component/image.rb,
lib/ecoportal/api/v2/s3/files/poll_status.rb,
lib/ecoportal/api/v2/page/component/action.rb,
lib/ecoportal/api/v2/page/permission_flags.rb,
lib/ecoportal/api/v2/pages/page_stage/task.rb,
lib/ecoportal/api/v2/registers/page_result.rb,
lib/ecoportal/api/v2/s3/files/batch_upload.rb,
lib/ecoportal/api/v2/pages/page_stage/tasks.rb,
lib/ecoportal/api/v2/registers/stage_result.rb,
lib/ecoportal/api/v2/registers/stages_result.rb,
lib/ecoportal/api/v2/page/component/geo_field.rb,
lib/ecoportal/api/v2/page/component/law_field.rb,
lib/ecoportal/api/v2/page/component/tag_field.rb,
lib/ecoportal/api/v2/registers/search_results.rb,
lib/ecoportal/api/v2/page/component/date_field.rb,
lib/ecoportal/api/v2/page/component/gauge_stop.rb,
lib/ecoportal/api/v2/page/component/chart_field.rb,
lib/ecoportal/api/v2/page/component/files_field.rb,
lib/ecoportal/api/v2/page/component/gauge_field.rb,
lib/ecoportal/api/v2/pages/page_create_response.rb,
lib/ecoportal/api/v2/page/component/action_field.rb,
lib/ecoportal/api/v2/page/component/images_field.rb,
lib/ecoportal/api/v2/page/component/number_field.rb,
lib/ecoportal/api/v2/page/component/people_field.rb,
lib/ecoportal/api/v2/page/component/actions_field.rb,
lib/ecoportal/api/v2/page/component/mailbox_field.rb,
lib/ecoportal/api/v2/page/component/chart_fr_field.rb,
lib/ecoportal/api/v2/page/component/checklist_item.rb,
lib/ecoportal/api/v2/page/component/checklist_field.rb,
lib/ecoportal/api/v2/page/component/geo_coordinates.rb,
lib/ecoportal/api/v2/page/component/reference_field.rb,
lib/ecoportal/api/v2/page/component/rich_text_field.rb,
lib/ecoportal/api/v2/page/component/selection_field.rb,
lib/ecoportal/api/v2/page/component/signature_field.rb,
lib/ecoportal/api/v2/page/component/plain_text_field.rb,
lib/ecoportal/api/v2/page/component/selection_option.rb,
lib/ecoportal/api/v2/page/component/chart_field/serie.rb,
lib/ecoportal/api/v2/page/component/selection_options.rb,
lib/ecoportal/api/v2/page/component/chart_field/config.rb,
lib/ecoportal/api/v2/page/component/chart_field/sankey.rb,
lib/ecoportal/api/v2/page/component/chart_field/heatmap.rb,
lib/ecoportal/api/v2/page/component/chart_field/benchmark.rb,
lib/ecoportal/api/v2/page/component/chart_field/frequency.rb,
lib/ecoportal/api/v2/page/component/chart_field/indicator.rb,
lib/ecoportal/api/v2/page/component/people_viewable_field.rb,
lib/ecoportal/api/v2/page/component/chart_field/multiseries.rb,
lib/ecoportal/api/v2/registers/page_result/membrane_droplet.rb,
lib/ecoportal/api/v2/page/component/chart_field/series_config.rb,
lib/ecoportal/api/v2/page/component/contractor_entities_field.rb
Defined Under Namespace
Classes: Page, Pages, People, Registers, S3
Constant Summary collapse
- VERSION =
"v2".freeze
Instance Attribute Summary collapse
-
#client ⇒ Common::Client
readonly
a
Common::Client
object that holds the configuration of the api connection. -
#logger ⇒ Logger
readonly
the logger.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api_key = nil, user_key: nil, org_key: nil, host: "live.ecoportal.com", logger: default_logger) ⇒ V2
constructor
Creates an
V2
object to scope version specific api requests. -
#pages ⇒ Pages
Obtain specific object for pages api requests.
-
#people ⇒ People
Obtain specific object for people api requests.
-
#registers ⇒ Registers
Obtain specific object for schema api requests.
-
#s3 ⇒ S3
Obtain specific object for file api requests.
Constructor Details
#initialize(api_key = nil, user_key: nil, org_key: nil, host: "live.ecoportal.com", logger: default_logger) ⇒ V2
Note:
- You should use either
api_key
oruser_key
andorg_key
- The const
VERSION
determineds the api version that client will query against. - This means that each subclass of
V2
should define their ownVERSION
constant.
Creates an V2
object to scope version specific api requests.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ecoportal/api/v2.rb', line 44 def initialize(api_key = nil, user_key: nil, org_key: nil, host: "live.ecoportal.com", logger: default_logger) v2key = get_key(api_key: api_key, user_key: user_key, org_key: org_key) @logger = logger @client = Common::Content::Client.new( api_key: v2key, host: host, version: self.class::VERSION, logger: @logger ) end |
Instance Attribute Details
#client ⇒ Common::Client (readonly)
a Common::Client
object that holds the configuration of the api connection.
7 8 9 |
# File 'lib/ecoportal/api/v2.rb', line 7 def client @client end |
#logger ⇒ Logger (readonly)
the logger.
7 8 9 |
# File 'lib/ecoportal/api/v2.rb', line 7 def logger @logger end |
Class Method Details
.v2key(ukey, gkey) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/ecoportal/api/v2.rb', line 19 def v2key(ukey, gkey) Base64.urlsafe_encode64({ organization: gkey, user: ukey }.to_json) end |
Instance Method Details
#pages ⇒ Pages
Obtain specific object for pages api requests.
69 70 71 |
# File 'lib/ecoportal/api/v2.rb', line 69 def pages pages_class.new(client) end |
#people ⇒ People
Obtain specific object for people api requests.
57 58 59 |
# File 'lib/ecoportal/api/v2.rb', line 57 def people people_class.new(client) end |
#registers ⇒ Registers
Obtain specific object for schema api requests.
63 64 65 |
# File 'lib/ecoportal/api/v2.rb', line 63 def registers registers_class.new(client) end |
#s3 ⇒ S3
Obtain specific object for file api requests.
75 76 77 |
# File 'lib/ecoportal/api/v2.rb', line 75 def s3 # rubocop:disable Naming/VariableNumber s3_class.new(client) end |