Class: Harvest::LineItem

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/harvest/line_item.rb

Instance Method Summary collapse

Constructor Details

#initialize(args = {}, _ = nil) ⇒ LineItem

Returns a new instance of LineItem.



3
4
5
6
7
# File 'lib/harvest/line_item.rb', line 3

def initialize(args = {}, _ = nil)
  args = args.stringify_keys
  self.project = args.delete('project') if args['project']
  super
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/harvest/line_item.rb', line 13

def active?
  !deactivated
end

#line_item_as_jsonObject



17
18
19
# File 'lib/harvest/line_item.rb', line 17

def line_item_as_json
  { 'line_item' => { 'id' => line_item_id } }
end

#project=(project) ⇒ Object



9
10
11
# File 'lib/harvest/line_item.rb', line 9

def project=(project)
  self['project_id'] = project['id']
end