Method: JetSet::Environment#map

Defined in:
lib/jet_set/environment.rb

#map(&block) ⇒ Object

Accepts Ruby block with mapping definition. Parameters:

+&block+: Ruby block

Usage:

JetSet::Mapping.new do
  entity Invoice do
    field :amount
    field :created_at
    collection :line_items
    reference :subscription, type: Subscription
  end
  ...
  entity User do
    field :amount
    field :created_at
    collection :line_items
    reference :subscription, type: Subscription
  end
end


83
84
85
86
87
88
89
# File 'lib/jet_set/environment.rb', line 83

def map(&block)
  unless block_given?
    raise MapperError, 'Mapping should be defined as Ruby block.'
  end

  Mapping.new(&block)
end