Class: Braintree::LocalPaymentContext

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/local_payment_context.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included

Methods included from BaseModule::Methods

#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class

Constructor Details

#initialize(attributes) ⇒ LocalPaymentContext

Returns a new instance of LocalPaymentContext.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/braintree/local_payment_context.rb', line 20

def initialize(attributes)
  @attrs = [:amount, :approval_url, :approved_at, :attrs, :created_at, :expired_at, :id, :legacy_id,
            :merchant_account_id, :order_id, :payment_id, :transacted_at, :type, :updated_at]

  if attributes.key?(:response)
    response = attributes[:response]
    @id = _get_value(response, "paymentContext.id")
    @legacy_id = _get_value_optional(response, "paymentContext.legacyId")
    @type = _get_value(response, "paymentContext.type")
    @payment_id = _get_value_optional(response, "paymentContext.paymentId")
    @order_id = _get_value_optional(response, "paymentContext.orderId")
    @approval_url = _get_value_optional(response, "paymentContext.approvalUrl")
    @merchant_account_id = _get_value_optional(response, "paymentContext.merchantAccountId")
    @created_at = _get_value_optional(response, "paymentContext.createdAt")
    @updated_at = _get_value_optional(response, "paymentContext.updatedAt")
    @transacted_at = _get_value_optional(response, "paymentContext.transactedAt")
    @approved_at = _get_value_optional(response, "paymentContext.approvedAt")
    @expired_at = _get_value_optional(response, "paymentContext.expiredAt")
    @amount = _extract_amount(response)
  else
    set_instance_variables_from_hash(attributes)
  end
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



5
6
7
# File 'lib/braintree/local_payment_context.rb', line 5

def amount
  @amount
end

#approval_urlObject (readonly)

Returns the value of attribute approval_url.



6
7
8
# File 'lib/braintree/local_payment_context.rb', line 6

def approval_url
  @approval_url
end

#approved_atObject (readonly)

Returns the value of attribute approved_at.



7
8
9
# File 'lib/braintree/local_payment_context.rb', line 7

def approved_at
  @approved_at
end

#attrsObject (readonly)

Returns the value of attribute attrs.



8
9
10
# File 'lib/braintree/local_payment_context.rb', line 8

def attrs
  @attrs
end

#created_atObject (readonly)

Returns the value of attribute created_at.



9
10
11
# File 'lib/braintree/local_payment_context.rb', line 9

def created_at
  @created_at
end

#expired_atObject (readonly)

Returns the value of attribute expired_at.



10
11
12
# File 'lib/braintree/local_payment_context.rb', line 10

def expired_at
  @expired_at
end

#idObject (readonly)

Returns the value of attribute id.



11
12
13
# File 'lib/braintree/local_payment_context.rb', line 11

def id
  @id
end

#legacy_idObject (readonly)

Returns the value of attribute legacy_id.



12
13
14
# File 'lib/braintree/local_payment_context.rb', line 12

def legacy_id
  @legacy_id
end

#merchant_account_idObject (readonly)

Returns the value of attribute merchant_account_id.



13
14
15
# File 'lib/braintree/local_payment_context.rb', line 13

def 
  @merchant_account_id
end

#order_idObject (readonly)

Returns the value of attribute order_id.



14
15
16
# File 'lib/braintree/local_payment_context.rb', line 14

def order_id
  @order_id
end

#payment_idObject (readonly)

Returns the value of attribute payment_id.



15
16
17
# File 'lib/braintree/local_payment_context.rb', line 15

def payment_id
  @payment_id
end

#transacted_atObject (readonly)

Returns the value of attribute transacted_at.



16
17
18
# File 'lib/braintree/local_payment_context.rb', line 16

def transacted_at
  @transacted_at
end

#typeObject (readonly)

Returns the value of attribute type.



17
18
19
# File 'lib/braintree/local_payment_context.rb', line 17

def type
  @type
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



18
19
20
# File 'lib/braintree/local_payment_context.rb', line 18

def updated_at
  @updated_at
end

Class Method Details

._new(*args) ⇒ Object



53
54
55
# File 'lib/braintree/local_payment_context.rb', line 53

def self._new(*args)
  self.new(*args)
end

Instance Method Details

#inspectObject



44
45
46
47
# File 'lib/braintree/local_payment_context.rb', line 44

def inspect
  inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
  "#<#{self.class} #{inspected_attributes.join(" ")}>"
end