Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class AddReceiveModelCard < Action
def self.update_state(state, resolve_id, data)
model_card_id = data['modelCardId']
account_id = data['accountId']
server_url = data['serverUrl']
workspace_id = data['workspaceId']
workspace_slug = data['workspaceSlug']
project_id = data['projectId']
model_id = data['modelId']
project_name = data['projectName']
Expand All @@ -32,7 +34,7 @@ def self.update_state(state, resolve_id, data)
has_dismissed_update_warning = data['hasDismissedUpdateWarning']
baked_object_ids = data['bakedObjectIds'].nil? ? nil : data['bakedObjectIds'].values

receive_card = Cards::ReceiveCard.new(model_card_id, account_id, workspace_id,
receive_card = Cards::ReceiveCard.new(model_card_id, account_id, server_url, workspace_id, workspace_slug,
project_id, model_id,
project_name, model_name,
selected_version_id, selected_version_source_app, selected_version_user_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def self.update_state(state, resolve_id, data)
send_card = Cards::SendCard.new(
data['modelCardId'],
data['accountId'],
data['serverUrl'],
data['workspaceId'],
data['workspaceSlug'],
data['projectId'],
data['projectName'],
data['modelId'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ def self.update_state(state, resolve_id)
send_card = Cards::SendCard.new(
id,
card['account_id'],
card['server_url'],
card['workspace_id'],
card['workspace_slug'],
card['project_id'],
card['project_name'],
card['model_id'],
Expand All @@ -36,7 +38,9 @@ def self.update_state(state, resolve_id)
{
modelCardId: send_card.model_card_id,
accountId: send_card.account_id,
serverUrl: send_card.server_url,
workspaceId: send_card.workspace_id,
workspaceSlug: send_card.workspace_slug,
projectId: send_card.project_id,
modelId: send_card.model_id,
sendFilter: send_card.send_filter,
Expand All @@ -51,7 +55,7 @@ def self.update_state(state, resolve_id)

# TODO: CONVERTER_V2: Extract into new actions
receive_cards = receive_cards_hash.collect do |id, card|
receive_card = Cards::ReceiveCard.new(id, card['account_id'], card['workspace_id'], card['project_id'], card['model_id'],
receive_card = Cards::ReceiveCard.new(id, card['account_id'], card['server_url'], card['workspace_id'], card['workspace_slug'], card['project_id'], card['model_id'],
card['project_name'], card['model_name'], card['selected_version_id'],
card['selected_version_source_app'], card['selected_version_user_id'],
card['latest_version_id'], card['latest_version_source_app'],
Expand All @@ -63,7 +67,9 @@ def self.update_state(state, resolve_id)
{
modelCardId: receive_card.model_card_id,
accountId: receive_card.account_id,
serverUrl: receive_card.server_url,
workspaceId: receive_card.workspace_id,
workspaceSlug: receive_card.workspace_slug,
projectId: receive_card.project_id,
modelId: receive_card.model_id,
projectName: receive_card.project_name,
Expand Down
12 changes: 11 additions & 1 deletion speckle_connector_3/src/cards/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,37 @@ class Card < Hash
# @return [String] workspace id of the card.
attr_reader :workspace_id

# @return [String] workspace slug of the card.
attr_reader :workspace_slug

# @return [String] server url of the card.
attr_reader :server_url

# @return [Boolean] card is valid or not.
attr_reader :valid

# rubocop:disable Metrics/ParameterLists
def initialize(model_card_id, account_id, workspace_id, project_id, project_name, model_id, model_name)
def initialize(model_card_id, account_id, server_url, workspace_id, workspace_slug, project_id, project_name, model_id, model_name)
super()
@model_card_id = model_card_id
@account_id = account_id
@workspace_id = workspace_id
@workspace_slug = workspace_slug
@project_id = project_id
@project_name = project_name
@model_id = model_id
@model_name = model_name
@server_url = server_url
@valid = true
self[:model_card_id] = model_card_id
self[:account_id] = account_id
self[:workspace_id] = workspace_id
self[:workspace_slug] = workspace_slug
self[:project_id] = project_id
self[:project_name] = project_name
self[:model_id] = model_id
self[:model_name] = model_name
self[:server_url] = server_url
self[:valid] = @valid
end
# rubocop:enable Metrics/ParameterLists
Expand Down
4 changes: 3 additions & 1 deletion speckle_connector_3/src/cards/receive_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class ReceiveCard < Card
def initialize(
model_card_id,
account_id,
server_url,
workspace_id,
workspace_slug,
project_id,
model_id,
project_name,
Expand All @@ -63,7 +65,7 @@ def initialize(
expired,
baked_object_ids = nil
)
super(model_card_id, account_id, workspace_id, project_id, project_name, model_id, model_name)
super(model_card_id, account_id, server_url, workspace_id, workspace_slug, project_id, project_name, model_id, model_name)
@selected_version_id = selected_version_id
@selected_version_source_app = selected_version_source_app
@selected_version_user_id = selected_version_user_id
Expand Down
4 changes: 3 additions & 1 deletion speckle_connector_3/src/cards/send_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class SendCard < Card
def initialize(
model_card_id,
account_id,
server_url,
workspace_id,
workspace_slug,
project_id,
project_name,
model_id,
Expand All @@ -35,7 +37,7 @@ def initialize(
send_filter,
send_settings
)
super(model_card_id, account_id, workspace_id, project_id, project_name, model_id, model_name)
super(model_card_id, account_id, server_url, workspace_id, workspace_slug, project_id, project_name, model_id, model_name)
@send_filter = send_filter
@send_settings = send_settings
@latest_created_version_id = latest_created_version_id
Expand Down
38 changes: 19 additions & 19 deletions speckle_connector_3/src/cards/send_card_multiple_filters.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# frozen_string_literal: true

require_relative 'card'

module SpeckleConnector3
module Cards
# Send card for sketchup connector to communicate speckle.
class SendCardMultipleFilters < Card
# @return [Hash{String=>Filter}] filters of the card.
attr_reader :filters

def initialize(card_id, account_id, project_id, model_id, filters)
super(card_id, account_id, project_id, model_id)
@filters = filters
self[:filters] = filters
end
end
end
end
# # frozen_string_literal: true
#
# require_relative 'card'
#
# module SpeckleConnector3
# module Cards
# # Send card for sketchup connector to communicate speckle.
# class SendCardMultipleFilters < Card
# # @return [Hash{String=>Filter}] filters of the card.
# attr_reader :filters
#
# def initialize(card_id, account_id, project_id, model_id, filters)
# super(card_id, account_id, project_id, model_id)
# @filters = filters
# self[:filters] = filters
# end
# end
# end
# end