Skip to content

Cannot initialize library following example setup docs NameError: uninitialized constant DingSDK::Ding::SERVER_PRODUCTION #1

Description

@noahpryor

I'm getting an error that I believe is intrinsic to the gem (e.g. not a problem on my side) when trying to configure the library.

Currently using ruby 3.1.4

Running DingSDK::Ding.new gives the following error:

NameError: uninitialized constant DingSDK::Ding::SERVER_PRODUCTION

      server = SERVER_PRODUCTION if server.nil?
               ^^^^^^^^^^^^^^^^^
from //gems/ding_sdk-0.7.4/lib/ding_sdk/ding.rb:53:in `initialize'

Passing in a server argument DingSDK::Ding.new(server: "beehiiv")
Gets you

TypeError: Parameter 'server_idx': Expected type T.nilable(Integer), got type String with value "beehiiv"

Trying passing in an integer gives the following error

TypeError: Parameter 'server': Expected type String, got type Integer with value 1

Additionally, I'm pretty sure the syntax for the setup steps given during onboarding is not correct, though the above errors keep me from fully validating.

s.config_security(
  security=Shared::Security.new(
    api_key="",
  )
)

Shared::Security needs to be namespaced under DingSDK::Shared::Security, and values should probably be assigned here as attributes of a hash rather than security= based on my quick skim of the code.

Finally, it's pretty aggressive to require sorbet as a runtime dependency here, but I can work around that if the above works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions