Skip to content

Escape hatch #82

Closed
Closed

Description

@9mm

Is there an escape hatch to just make a request with custom method/path/options?

I also need to update settings in the zone and it doesn't appear to be in there... unless I'm mistaken. I dont necessarily want to have to make PRs for every endpoint in the short term (just while library is being worked on, as it seems like WIP)

Activity

  1. ioquatix commented on Sep 24, 2024

    @ioquatix
    Member

    Yes, you can, e.g. something like this:

    Cloudflare::Representation.new(connection.with(path: "whatever/"))
    

    It will create a generic representation of the given resource (path). You can provide whatever arguments, e.g. with(parameters: {url parameters}) and then use Cloudflare::Representation.$http_method to do actual operations, e.g.

    def update_content(content, **options)
    self.class.put(@resource, {
    type: self.type,
    name: self.name,
    content: content,
    **options
    }) do |resource, response|
    if response.success?
    @value = response.read
    @metadata = response.headers
    else
    raise RequestError.new(resource, response.read)
    end
    self
    end
    end

    Let me know if you need more specifics. It's also fine to make PRs adding missing functionality. I wouldn't call this gem a WIP, but Cloudflare makes it extremely hard to test anything (there are no sandbox accounts), and so it's kind of on an as needed basis as users contribute.

  2. 9mm commented on Sep 24, 2024

    @9mm
    ContributorAuthor

    awesome, thanks!

  3. locked and limited conversation to collaborators on Sep 24, 2024
  4. converted this issue into a discussion #83 on Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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