Class: AirbyteRuby::Resources::Connection
- Defined in:
- lib/airbyte_ruby/resources/connection.rb
Overview
Resource class for Airbyte Connections
Constant Summary collapse
- ENDPOINTS =
OpenStruct.new( list: "/connections?includeDeleted=false&limit=20&offset=0", create: "/connections", get: "/connections/:connection_id", update: "/connections/:connection_id", delete: "/connections/:connection_id" )
Instance Attribute Summary collapse
-
#destination_id ⇒ Object
readonly
Returns the value of attribute destination_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source_id ⇒ Object
readonly
Returns the value of attribute source_id.
-
#workspace_id ⇒ Object
readonly
Returns the value of attribute workspace_id.
Instance Method Summary collapse
- #fetch ⇒ Object
- #fetch_all ⇒ Object
-
#initialize(args = {}) ⇒ Connection
constructor
TODO: Include Base module once ready rubocop:disable Lint/MissingSuper.
- #new ⇒ Object
- #remove ⇒ Object
-
#to_json(*_args) ⇒ Object
rubocop:enable Lint/MissingSuper.
- #update ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Connection
TODO: Include Base module once ready rubocop:disable Lint/MissingSuper
19 20 21 22 23 24 25 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 19 def initialize(args = {}) @id = args[:id] @name = args[:name] @workspace_id = args[:workspace_id] @source_id = args[:source_id] @destination_id = args[:destination_id] end |
Instance Attribute Details
#destination_id ⇒ Object (readonly)
Returns the value of attribute destination_id.
15 16 17 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 15 def destination_id @destination_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 15 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 15 def name @name end |
#source_id ⇒ Object (readonly)
Returns the value of attribute source_id.
15 16 17 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 15 def source_id @source_id end |
#workspace_id ⇒ Object (readonly)
Returns the value of attribute workspace_id.
15 16 17 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 15 def workspace_id @workspace_id end |
Instance Method Details
#fetch ⇒ Object
44 45 46 47 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 44 def fetch url = replace_variable_in_url(ENDPOINTS.get, "connection_id") get(url) end |
#fetch_all ⇒ Object
36 37 38 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 36 def fetch_all list(ENDPOINTS.list) end |
#new ⇒ Object
40 41 42 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 40 def new create(ENDPOINTS.create) end |
#remove ⇒ Object
54 55 56 57 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 54 def remove url = replace_variable_in_url(ENDPOINTS.delete, "connection_id") delete(url) end |
#to_json(*_args) ⇒ Object
rubocop:enable Lint/MissingSuper
28 29 30 31 32 33 34 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 28 def to_json(*_args) { name: @name, sourceId: @source_id, destinationId: @destination_id }.to_json end |
#update ⇒ Object
49 50 51 52 |
# File 'lib/airbyte_ruby/resources/connection.rb', line 49 def update url = replace_variable_in_url(ENDPOINTS.update, "connection_id") patch(url) end |