Module Her::Model::HTTP::ClassMethods
In: lib/her/model/http.rb

For each HTTP method, define these class methods:

  • <method>(path, params)
  • <method>_raw(path, params, &block)
  • <method>_collection(path, params, &block)
  • <method>_resource(path, params, &block)
  • custom_<method>(*paths)

@example

  class User
    include Her::Model
    custom_get :active
  end

  User.get(:popular) # GET "/users/popular"
  User.active # GET "/users/active"

Methods

her_api   request   use_api   uses_api  

Public Instance methods

her_api(value = nil)

Alias for use_api

Change which API the model will use to make its HTTP requests

@example

  secondary_api = Her::API.new :url => "https://api.example" do |connection|
    connection.use Faraday::Request::UrlEncoded
    connection.use Her::Middleware::DefaultParseJSON
  end

  class User
    include Her::Model
    use_api secondary_api
  end
uses_api(value = nil)

Alias for use_api

[Validate]